[thelist] PHP MySQL Connections
Matt Warden
mwarden at gmail.com
Thu Jan 27 18:17:13 CST 2005
On Thu, 27 Jan 2005 14:47:32 -0800, Maximillian Schwanekamp
<lists at neptunewebworks.com> wrote:
> So my question is, from the perspective of execution time, is this going
> to be much less efficient than say, passing a reference to a single DB
> object between the different objects?
Certainly opening multiple connections is going to be less efficient
than simply passing a variable reference.
In fact, while it might not be the most 'correct' way of coding
things, you could write your code to assume that a connection has
already been established, as most (if not all) relevant methods in PHP
will use the most recently opened connection by default.
However, I would just pass the reference, if I were you.
Alternatively, you may find this helpful:
http://us3.php.net/manual/en/features.persistent-connections.php
--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.
More information about the thelist
mailing list