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
https://forums.phpfreaks.com/topic/108790-mysql_close-absolutely-necessary/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.