The mysqli_close() function closes a previously opened database connection.
PHP mysqli_close() Function has the following syntax.
mysqli_close(connection);
Parameter | Is Required | Description |
---|---|---|
connection | Required. | MySQL connection |
It returns TRUE on success or FALSE on failure.
The following code closes a previously opened database connection.
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
mysqli_close($con);
?>