Re: Connecting to two MySQL databases

From: Date: Sat, 01 Oct 2005 15:16:35 +0000
Subject: Re: Connecting to two MySQL databases
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-40441@lists.php.net to get a copy of this message
On Sep 30, 2005, at 11:51 AM, Larry E. Ullman wrote:
I had this problem a while ago, when you try to create the second connection to the database with the same login credentials, i.e username and password. If mysql / php detect there is a connection already established with those details it will return that specfic resouce and not create an new connection. The only way around this is to create a new username + password for this database and use those details to generate the second connection.
Actually, the mysql_connect() function takes an optional fourth argument indicating whether or not a new connection should be made. If omitted, then PHP will do exactly what you are describing. If set, then PHP will create a new connection, even if the same username/password/host combination is being used. Larry --
Is this just a 1|0 (bool)? Thanks, Charles

« previous php.db (#40441) next »