Re: Multiple MySQL Connections

From: Date: Mon, 13 Mar 2006 16:29:33 +0000
Subject: Re: Multiple MySQL Connections
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-22373@lists.php.net to get a copy of this message
On 13.03.2006 18:05, Nick Mitin wrote:
I was trying to create 2 mysql connections. $l1 = mysql_pconnect(“localhost”, “user”, “pass”); mysql_select_db(“db1”, $l1); $l2 = mysql_pconnect(“localhost”, “user”, “pass”); mysql_select_db(“db1”, $l2); The $l1 and $l2 now contains different resource ids (#1, #2), but mysql_query(“select * from table”, $l1) somehow uses the second connection.
Yes, this is the same connection. This is by design. If you need to open a separate connection - use mysql_connect() with 4th parameter set to TRUE. -- Wbr, Antony Dovgal

« previous php.internals (#22373) next »