1. Computing

How to close your MySQL connection from PHP

By

If you open a connection to MySQL within your PHP file you can close it again by using the mysql_close () function. Not all programs use this. Some find it is unnecessary, because MySQL connections are usually closed by default at the end of the script.

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password') ;
if (!$link)
{
die(mysql_error()) ;
}
print 'You are connected';
mysql_close($link) ;
?>

©2014 About.com. All rights reserved.