RE: [PHP] Why use persistent connections? || Data driven site
| From: | John W. Holmes | Date: | Sat, 22 Feb 2003 22:09:26 +0000 |
| Subject: | RE: [PHP] Why use persistent connections? || Data driven site | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136678@lists.php.net to get a copy of this message | ||
> We've got a site makes several queries to our MySql db in every site
page.
> Should we be using persistent connections, or are we better off
opening
> and
> closing connections on each query?
You should open a connection at the beginning of your page, run your
multiple queries, and then close it at the end. You shouldn't be opening
a connection for each query.
As for persistent vs. normal, here's a good explanation of each option:
http://www.php.net/manual/en/features.persistent-connections.php
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/