Can someone clarify for me what the advantages and disadvantages of using MySQLi instead of MySQL? Are there situations where I should not use MySQLi? Do I need to configure my server differently in order to use MySQLi? For instance, do I need to upgrade Apache or PHP so I can support MySQLi?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Unless you are using an old version of the MySQL database (prior to 4.1.3) or require some functionality not yet included in MySQLi (I think there are one of two functions that weren't moved over) then stick with MySQLi when ever you can.
Reasons why you should use MySQLi extension instead of the MySQL extension are many:
And there are other benefits. But mainly, you should focus on security and stabiltity - and MySQLi gives you just that.
PHP team refuse to support mysql extension any further. This reason is alone enough.
All other reasons don't make much sense:
START TRANSACTION
query and you're set.So, there are no advantages at all.
If you want to get along with non-deprecated but usable extension - go for the PDO.
Always, if possible.
It is possible that MySQLi is not supported by your PHP install. However, most hosting providers have support for MySQLi.
If you are using
mysql
> 4.1.3. Mysqli is a new interface for mysql in php. A quote from http://www.php.net/manual/en/mysqli.overview.phpWhat is PHP's MySQL Extension?
This is the original extension designed to allow you to develop PHP applications that interact with a MySQL database. The mysql extension provides a procedural interface and is intended for use only with MySQL versions older than 4.1.3. This extension can be used with versions of MySQL 4.1.3 or newer, but not all of the latest MySQL server features will be available.