To close an open MySQl connection in php, the mysql_close()helps to perform this function. The mysql_close() function is not the necessary part in our program. In non-persistent open links are automatically closed at the end of the script’s execution.
Syntax
mysql_close(connection)
Example
}
mysql_close($con); if ($con) { echo "
disconnected successfully at:".date("d/m/y : H:i:s", time()) ; } ?>
Output :
connected successfully at:26/07/10 : 09:31:14
disconnected successfully at:26/07/10 : 09:31:15
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.