Re: MySQL close connection, what's the purpose?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, March 31, 2006 2:30 pm, Martin Zvarík wrote:
>     I was wondering why is it necessary to use mysql_close() at the
> end
> of your script.
> If you don't do it, it works anyways, doesn't it?

Yes, but...

Suppose you write a script to read data from one MySQL server, and
then insert it into 200 other MySQL servers, as a sort of home-brew
replication (which would be really dumb to do, mind you)...

In that case, you REALLY don't want the overhead of all 200
connections open, so after you finish each one, you would close it.

There are also cases where you finish your MySQL work, but have a TON
of other stuff to do in the script, which will not require MySQL.

Close the connection to free up the resource, like a good little boy. :-)

There also COULD be cases where your PHP script is not ending
properly, and you'd be better off to mysql_close() yourself.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux