The first two functions are used to process the db.
First, the MYSQLI connection is a permanent connection, and MySQL is a non-permanent connection. What do you mean? The MySQL connection will reopen a new process whenever it is used for the second time, while Mysqli will only use the same process, which can greatly reduce the server-side pressure.
Second, mysqli encapsulates some advanced operations, such as transactions, while encapsulating many of the methods available in the DB operation process.
The most widely used place is the mysqli transaction.
such as the following example:
Copy CodeThe code is as follows:
$mysqli = new mysqli (' localhost ', ' root ', ' ', ' db_lib2test ');
$mysqli->autocommit (FALSE);//Start things
$mysqli->query ($sql 1);
$mysqli->query ($sql 2);
if (! $mysqli->errno) {
$mysqli->commit ();
echo ' OK ';
}else{
echo ' err ';
$mysqli->rollback ();
}
http://www.bkjia.com/PHPjc/327585.html www.bkjia.com true http://www.bkjia.com/PHPjc/327585.html techarticle the first two functions are used to process the db. First, the MYSQLI connection is a permanent connection, and MySQL is a non-permanent connection. What do you mean? MySQL connection whenever you use the second time, will ...