User Contributed Notes 4 notes

mysql_* functions are deprecated and will be removed from future versions in PHP. If you have an existing codebase that you are moving to such PHP version and is having a hard time converting to PDO/MySQLI you can use a PDO wrapper for all mysql_* functions found on github: https://github.com/azizsaleh/mysql

Apart from the feature list, I suggest you try out both MySQLi and PDO and find out what API design you like most. MySQLi is more powerful and probably more complex to learn. PDO is more elegant and has the advantage that you only need to learn one PHP API if you need to work with different DBMS in the future.

Another useful consideration to keep in mind when choosing your library is how extensible it is. Chances are, in any sufficiently advanced development scenario, you're going to be extending your database access class to add a method (or multiple methods) for how to handle database errors and alert the development team of errors and whether to have the code fail immediately or fail gracefully serving the user a user-friendly failure notice.

For example, I have a class where I have added extra parameters to the query() function (and a few others), which accept the __FILE__ and __LINE__ constants to facilitate tracking issues. If this were not reasonably possible with PDO-mysql for example (not sure, never used it), it may make one option or the other much less likely to be viable for your usage case.

This is only a very basic example. You may otherwise choose to "wrap" the PDO class and save an instance of the "underlaying" PDO class inside the wrapper class. This is maybe a little more complex approach but allows you to have on interfaces in class signature + way better flexibility.