This article describes the PHP in the use of MySQL and mysqli in the usage of some differences, there is a need for friends reference. MySQL and mysqli differences: MySQL and mysqli (MySQL improved) is a library functions (or Extension) in the PHP which was used to ACC ES MySQL database. Mysqli is the improved version of MySQL which support OOPS. The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above. MySQL is a non-holding connection function and Mysqli is a permanent connection function. MySQL each time the link opens a connected process and mysqli runs multiple times mysqli will use the same connection process, thereby reducing the server overhead. If using new mysqli (' localhost ', usenamer ', ' Password ', ' databasename '), always error, Fatal error:class ' mysqli ' not found in ... Then check to see if the mysqli is open. Mysqli class is not the default open, win under to change php.ini, remove php_mysqli.dll ago, Linux to the mysqli compiled into. In relation to PHP programming language, MySQL was the old database driver, and mysqli is the improved driver. Mysqli takes advantage of the newer features of MySQL 5. Lifted verbatim from the Php.net site:-object-oriented interface-support for Prepared statements-support for Multiple S Tatements-support for transactions-enhanced debugging capabilities-embedded Server Support You have the choice of using MySQL, mysqli, or PDO essentially. If you ' re simply looking for a relational database, you need look no further than MySQL, though there is many options Ava Ilable. You can use DBD, Postgres, MySQL, MSSQL, SQLite, etc etc etc... Hthsource (s): Http://www.php.net/manual/en/mysqli.over ... Mysqli usage: $mysqli = new mysqli (' localhost ', ' my_user ', ' My_password ', ' my_db '), MySQL usage: $link = mysql_connect (' example.com:3307 ', ' mysql_user ', ' Mysql_password '); When dealing with Chinese garbled problems, in $link = mysql_connect (' example.com:3307 ', ' Mysql_ User ', ' Mysql_password '); After setting the connection character set: mysql_query ("Set names UTF8"); Note: You cannot write Utf-8. Set the operating database: mysql_select_db ("my_db"), while using MYSQLI, the database name is a parameter of the Mysqli construction method, so setting the connection character set does not work at this point. |