Forum Moderators: coopster

Message Too Old, No Replies

mysql_close?

         

StickeR

12:15 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



Hiya,

This might be a dumb question, but:
How important is it to close a DB connection?

I accidentally forgot to do it in some pages and did in others, does this matter?

Which leads to another thing, I've read tutorials/examples which close it like this:
mysql_close();
whilst others use the connection string
mysql_close($connection);.

Which is better/does it matter?

Thanks in advance

Again pardon my ignorance, but I have a limited knowledge of this..

Warboss Alex

12:23 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



All open connections are closed automatically at the end of a script's execution, but it's good practice to close them yourself.

mysql_close($connection) closes the specific connection. I believe mysql_close() closes the last connection used?

Either way, you should only have one connection per script so the problem shouldn't arise.

:)

StickeR

1:12 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



thanks for the info