How to close mysql connection in php

青灯夜游
Release: 2023-03-08 19:34:01
Original
2771 people have browsed it

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.

How to close mysql connection in php

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);
Copy after login
  • 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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template