What's better PDO or mySqli?

In terms of not having a database attached to this website, what is better to use, PDO or mySqli?

I’m not sure I understand what you mean by not having a database attached to this website.

they company doesn’t need a database, but they will have a mail forms, hence I will create them with php

If you don’t have a database, then you don’t really need PDO or mySqli. Those are just used for interacting with databases.

okay fair enough, so with having a contact form, I’ve always made them using php. and my understanding is that mySql is depreciated after 5.5. So then what you suggest that I use create the form, while keeping out spam and other kind of injections.

Oh you can use PHP, but you don’t need to connect to a database, so that’s why you don’t need PDO or mySqli.

If I get a chance, I will dig up a sample PHP script for you. Or maybe someone else has one handy.

To clarify, if you have NO need for a database, then PDO and mysqli is completely out of hte picture. Those willl not help keep your script safe since you don’t need database interaction. For your problem, pretend PDO/Mysqli doesn’t exist.

Since they accessing a database, if you don’t have a database then you will not have either of them. So with no database which method for accessing databases is beter is irrelevant.

Aside from the statement there is no database at present, and therefore neither class is really relevant to the OP’s needs, I would have to go with PDO. PDO uses the mysqli drivers, so you tradeoff a very small amount of speed for the flexibility to change out database engines if needed. If you’re writing software others will use (such as Joomla or Drupal) then this is certainly a plus for PDO since abstracting the database in your program allows the end implementer to chose the database they want to use without modifying your code.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.