PHP Tutorial - PHP mysqli_close() Function






Definition

The mysqli_close() function closes a previously opened database connection.

Syntax

PHP mysqli_close() Function has the following syntax.

mysqli_close(connection);

Parameter

ParameterIs RequiredDescription
connectionRequired.MySQL connection

Return

It returns TRUE on success or FALSE on failure.

Example

The following code closes a previously opened database connection.


<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");


mysqli_close($con);
?>