1. Home
  2. Computing & Technology
  3. PHP / MySQL

MySQL_Close () PHP Function
Closing a MySQL connection from a PHP document

By Angela Bradley, About.com

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) ;
?>
More PHP / MySQL Quick Tips
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. PHP Mysql_Close - MySQL Close Function - Close MySQL Connection

©2009 About.com, a part of The New York Times Company.

All rights reserved.