ID: 13940
Updated by: mfischer
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: MySQL related
Operating System: RedHat 7.1
PHP Version: 4.2.0-dev
New Comment:

This is basically a dup of #14137, bogusifying this one.

Previous Comments:
------------------------------------------------------------------------

[2001-11-05 19:42:17] [EMAIL PROTECTED]

I can already hear the lame 'expected behavior, use mysql_select_db() before each 
query, blah, blah' excuses coming, but...

If you are able to set "properties" per connection resource, one would think that 
those "properties" stay with that connection resource and do not get overriden by 
setting "properties" for other connection resources.  This implementation seems rather 
misleading.  Not sure where to point the finger here, Zend Resource Management???

-Chris

yes I am aware I copy+pasted passwords, they are changed , not that you can access 
that server anyways :) 

------------------------------------------------------------------------

[2001-11-05 19:19:30] [EMAIL PROTECTED]

I need multiple connections to the same MySQL server to two different databases and 
mysql_select_db() is not honoring the resource_identifier, it is using the one of that 
last connection opened.

//script
<?php

// test mysql_select_db with two active connections

$conn1 = mysql_connect("localhost", "root" ,"#rain!");

if (!$conn1) {
    print "Could not connect to server one\n";
} else {
    if (!mysql_select_db("st2", $conn1))
        print "Could not select DB on server one ".mysql_error($conn1)."\n";
}

$conn2 = mysql_connect("localhost", "root" ,"#rain!");

if (!$conn2) {
    print "Could not connect to server two\n";
} else {
    if (!mysql_select_db("commercesys", $conn2))
        print "Could not select DB on server two ".mysql_error($conn2)."\n";
}

if (!mysql_query("select * from user", $conn1)) {
    print "Could not issue query to conn1 ".mysql_error($conn1)."\n";
}

if (!mysql_query("select * from customer", $conn2)) {
    print "Could not issue query to conn2 ".mysql_error($conn2)."\n";
}

?>

OUTPUT:
Could not issue query to conn1 Table 'commercesys.user' doesn't exist

If you flip the connect blocks you get:
Could not issue query to conn2 Table 'st2.customer' doesn't exist

I'll look at the source, but this is not too cool.

-Chris


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13940&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