Re: Database question
| From: | Jadiel Flores | Date: | Thu, 03 Jul 2003 15:40:11 +0000 |
| Subject: | Re: Database question | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29055@lists.php.net to get a copy of this message | ||
This is right, maybe you can assign the db link to a session variable but this will work only for one specific user, but what would happen if you have around 100 users at the same time?? you will have 100 different connections to the db, and that will be slower. So, maybe you should try to avoid having too much queries in your php pages.
At 11:32 AM 7/3/2003 -0400, you wrote:
On Thu, Jul 03, 2003 at 07:00:17AM -0700, Hardik Doshi wrote: Currently i am connecting the underlying database server from every php page. To reduce the connection overhead i am thinking to store the PEAR DB object into the registry (session) at the time of user login. Here i am connecting the Database only one time and rest of the time i am using the object stored in the memory. Nice as it sounds, this won't work. I don't recall where it's documented, but at least with MySQL (and I'm assuming with the others as well), a database link identifier cannot be stored in a session variable and then re-used by another session. Check out http://www.php.net/features.persistent-connections for details. --Jadiel Flores ------------------------- http://www.abargon.com jflores@abargon.com (52-55) 52-29-80-34Paul Chvostek <paul@it.ca> it.canada http://www.it.ca/ Free PHP web hosting! http://www.it.ca/web/-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php