Hello,
Doesn't using pconnect take care of this?
http://us.php.net/manual/en/function.mysql-pconnect.php
What's the best implementation?(provide some source if you can...)
- Ben
Ben Sgro, Chief Engineer
ProjectSkyLine - Defining New Horizons
----- Original Message -----
From: "Jakob Buchgraber" <[EMAIL PROTECTED]>
To: "NYPHP Talk" <talk@lists.nyphp.org>
Sent: Thursday, June 28, 2007 4:33 PM
Subject: Re: [nyphp-talk] When to close a mysql connection
David Krings wrote:
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
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
As long as you need to send queries to the database you should keep the
connection open, because connecting to the database is very often the
slowest part of the whole script.
- Jay
--
Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php