First of all, two functions are used to process db.
First, the MYSQLI connection is a permanent connection, and MySQL is a non permanent connection. What does that mean? The MySQL connection will reopen a new process whenever it is used for the second time, and Mysqli will only use the same process, which can greatly reduce server-side pressure.
Second, mysqli encapsulates some advanced operations, such as transactions, while encapsulating many of the methods available during the DB operation.
The most widely used place is the mysqli business.
Like the following example:
Copy Code code 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 ();
}