You are here : phpmysqlmysql_close

mysql_close() - mysql

mysql_close() closes the non-persistent connection to the MySQL server that's associated with the specified link identifier. If link_identifier isn't specified, the last opened link is used.


Syntax

bool mysql_close ([ resource $link_identifier = NULL ] )


Example

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>


Output / Return Value

Closes the MySQL Connection.


Limitations

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0.


Alternatives / See Also

The MySQLi or PDO_MySQL Should be used.


Reference

http://in.php.net/manual/en/function.mysql-close.php