First of all, both functions are used to process DB.
First of all, mysqli connection is a permanent connection, while mysql is a non-permanent connection. What does it mean? Whenever the mysql connection is used for the second time, a new process will be reopened, while mysqli only uses the same process, which can greatly reduce the pressure on the server side.
Secondly, mysqli encapsulates some advanced operations such as transactions, and also encapsulates many available methods in the DB operation process.
The place where it is most widely used is mysqli transactions.
For example:
Copy the code The code is as follows:
$mysqli = new mysqli('localhost','root','','DB_Lib2Test');
$mysqli->autocommit(false);//Start things
$mysqli->query($sql1);
$mysqli->query($sql2);
if(!$mysqli->errno){
$mysqli->commit();
echo 'ok';
}else{
echo 'err';
$mysqli->rollback();
}
http://www.bkjia.com/PHPjc/327585.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327585.htmlTechArticleFirst of all, both functions are used to process DB. First of all, mysqli connection is a permanent connection, while mysql is a non-permanent connection. What does it mean? Whenever the mysql connection is used for the second time, it will...