(1) The difference between MySQL and mysqli is:
The MYSQLI connection is a permanent connection, and MySQL is a non-permanent connection.
MySQL connection: Whenever a second use occurs, a new process is reopened.
MYSQLI Connection: Always use only the same process.
Benefits: This can greatly reduce the pressure on the server .
(2) mysql_connect and Mysql_pconnect and Mysqli_connect:
Mysql_pconnect The open connection is not closed (even if the call to Mysql_close is not closed because it is not valid),
Similar to the connection buffer pool, if the next time there is the same user name from the same machine
For a connection to the same database, PHP automatically uses the last connection that was established, without having to re-establish one.
Benefit: Eliminates the overhead of establishing a connection to the database each time,
Cons : It is necessary to waste some memory, occupy some connections,
So if the user access to a large number of errors will occur, to the mysql max_connections parameter to a larger, or use mysql_connect () to solve the problem.
Connect and pconnect do not have functional differences, only performance differences.
Generally PHP has two modes of operation, one is to run as a CGI, the second is to run as an Apache module.
Is there no difference between connect and pconnect as a CGI? Because every time the CGI runs, it is destroyed to clean up resources.
PHP learns the difference between MySQL and mysqli