1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

MySQL_Close () PHP Function

Closing a MySQL connection from a PHP document

By

Once you have opened a connection to your MySQL database from your PHP document, you can close it again using the mysql_close () function. Most of the time this isn't necessary, 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.