Jump to content

mysql_close()... absolutely necessary?


woolyg

Recommended Posts

Hi,

 

Is mysql_close() absolutely necessary?

 

The site I am coding uses quite a lot of mysql queries, all using the once connection, held in a

<?php require "db.php";
?>

 

..file.

 

For each of the queries that I make from my pages, do you believe I should close off every query after it's finished?

 

Your opinions please! :)

 

-WoolyG

Link to comment
Share on other sites

^ I find your username strange.

 

I put it in, better safe then sorry. Besides what have you got to lose? If you use a class in db.php just put:

 

function __destruct ()
{
mysql_close ();
}

 

And that's it.

Link to comment
Share on other sites

^ I find your username strange.

 

I put it in, better safe then sorry. Besides what have you got to lose? If you use a class in db.php just put:

 

function __destruct ()
{
mysql_close ();
}

 

And that's it.

 

Your function is a waste of processing power. declaring __destruct() isn't much shorter or easier then mysql_close();

 

Hoóker was right. PHP will do any necessary closing of connections, fixing up things by itself to ensure functionality.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.