NYCPHP Meetup

NYPHP.org

[nycphp-talk] When to close a mysql connection

David Krings ramons at gmx.net
Thu Jun 28 15:25:21 EDT 2007


Hi!

Up until now I always opened a db connection to MySQL, did my query 
stuff and then closed the connection again, went on to the next script, 
opened the db connection, did some more queries, closed the connection, 
went to next script.....

Is there anything speaking against making the db link pointer to be 
global, call the connection script once right at the start of the set of 
scripts and then assume that it is just there?

Or asking differently, is there anything speaking against opening and 
closing the db connection each time a set of queries is to be executed?

I just wonder if I make poor PHP / MySQL work harder than necessary.

David



More information about the talk mailing list