Waynn Lue wrote:
I sent an email to the mysql list, but it reminded me of a question I had
for people structuring their PHP code. What's the general way that people
structure their connections? Right now, I spawn off two mysql_connect calls
at the top of the file that includes my database calls, using "true" for the
fourth parameters, so as to create two new connections. Then I use those
two connections for two different databases I have to query from.
Is it better just to use mysql_select_db within the query function every
time for the same connection? Should I use mysql_connect every time without
using "true", so as to re-use connections. Should I be using pconnect
instead?
I spent some time looking for answers to these questions, but am getting
conflicting answers. Some people think relying on the re-use of these
functions is good, some think that explicit management is better. In
general, how have people on the list found them? For example, is having
constant mysql_select_db calls a problem?
Are they connecting as the same user and on the same server? Then you
can replace with a mysql_select_db call.
If they aren't both of those, you have no choice.
No idea if it'll make much of a difference (performance wise etc) but
I'd leave it as two connections.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php