|
|
 |
Re: FN-FORUM: PHP / MySQL Closing connections
date posted 21st August 2003 16:35
Bill Martin wrote:
> In a php script when you connect to a database (mysql_connect) then run
> a few queries and the page exits, does it automatically close the
> connection to mysql or do you have to close it in the code? I know it
> may be bad practice not to close it but I was under the impression it
> closed itself.
PHP *should* close the connection for you at the end of the script.
From http://uk.php.net/mysql_close :
"Using mysql_close() isn't usually necessary, as non-persistent open
links are automatically closed at the end of the script's execution."
> The other problem is that when I run a CHECK_TABLE command on a table in
> the database I get e.g. '12 clients is using or hasn't closed the table
> properly'. The check table command seems to clear this warning and
> running it again says the table is ok, but after a few days it starts to
> build up again the longer I leave it the more clients haven't closed the
> table properly. Is this a normal occurrence or have I made an oversight
> somewhere?
More info here:
http://makeashorterlink.com/?F5FF249A5
HTH
Matt
|
 |
|