Home>Article>Backend Development> How to close mysql connection in php
The mysqli_close() function can be used in php to close the mysql connection, the syntax format is "mysqli_close(connection);". The mysqli_close() function can close a previously opened database connection and returns TRUE if successful, otherwise it returns FALSE.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
php close mysql connection
When the database operation is completed, you can use mysql_close to close the database connection.
mysqli_close() function closes the previously opened database connection. The syntax is as follows:
mysqli_close(connection);
Parameter connection: required. Specifies the MySQL connection to be closed.
Return value: TRUE if successful, FALSE if failed.
When there are multiple database connections, you can set the connection resource parameters to close the specified database connection.
$link = mysql_connect($host, $user, $pass); mysql_close($link);
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to close mysql connection in php. For more information, please follow other related articles on the PHP Chinese website!