From:             [EMAIL PROTECTED]
Operating system: Debian/Linux
PHP version:      4.0CVS-2001-11-20
PHP Bug Type:     MySQL related
Bug description:  Request additional flag for mysql_connect

Manual states:

If a second call is made to mysql_connect() with the same 
arguments, no new link will be established, but instead, 
the link identifier of the already opened link will be 
returned. 

Most of the times this is good. With one exception.

Let's describe this situation.
I have 2 databases. I have 1 user account for mysql.
I need to use both of those databases simultaneously in my
script.
Now i do:
$id1 = mysql_connect($host, $username, $password);
mysql_select_db("db1", $id1);
$id2 = mysql_connect($host, $username, $password);
mysql_select_db("db2", $id2);

And now I think why so many errors :(

Second call to mysql_connect() returns same resource, so 
my active database is db2 now. But I want to use data from 
two databases at once. So this 'reuse' feature is bad for 
me.

Now, I use a wrapper class so I could issue an 
mysql_select_db() every time I do a query. But I think 
this is not a wise thing to do.

So I ask: Shouldn't be there a flag with meaning like 'do 
not try to reuse exitsing connection'. Or may be just an 
additional string argument 'database' which when specified
automagically selects that database and subsequent calls to
mysql_connect() take that value into account when deciding
to return or not to return existing resource.


-- 
Edit bug report at: http://bugs.php.net/?id=14137&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to