MySQL vs MySQLi when using PHP [closed]
If you have a look at MySQL Improved Extension Overview, it should tell you everything you need to know about the differences between the two.
The main useful features are:
- an Object-oriented interface
- support for prepared statements
- support for multiple statements
- support for transactions
- enhanced debugging capabilities
- embedded server support.
There is a manual page dedicated to help choosing between mysql, mysqli and PDO at
- http://php.net/manual/en/mysqlinfo.api.choosing.php and
- http://www.php.net/manual/en/mysqlinfo.library.choosing.php
The PHP team recommends mysqli or PDO_MySQL for new development:
It is recommended to use either the mysqli or PDO_MySQL extensions. It is not recommended to use the old mysql extension for new development. A detailed feature comparison matrix is provided below. The overall performance of all three extensions is considered to be about the same. Although the performance of the extension contributes only a fraction of the total run time of a PHP web request. Often, the impact is as low as 0.1%.
The page also has a feature matrix comparing the extension APIs. The main differences between mysqli and mysql API are as follows:
mysqli mysql
Development Status Active Maintenance only
Lifecycle Active Long Term Deprecation Announced*
Recommended Yes No
OOP API Yes No
Asynchronous Queries Yes No
Server-Side Prep. Statements Yes No
Stored Procedures Yes No
Multiple Statements Yes No
Transactions Yes No
MySQL 5.1+ functionality Yes No
* http://news.php.net/php.internals/53799
There is an additional feature matrix comparing the libraries (new mysqlnd versus libmysql) at
- http://www.php.net/manual/en/mysqlinfo.library.choosing.php
and a very thorough blog article at
- http://blog.ulf-wendel.de/2012/php-mysql-why-to-upgrade-extmysql/