PHP 4.0 Bug #5143: mysql_query() queries the last opened link, not the specified link
| From: | paolo at mailgate dot net | Date: | Tue, 20 Jun 2000 10:21:30 +0000 |
| Subject: | PHP 4.0 Bug #5143: mysql_query() queries the last opened link, not the specified link | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-21818@lists.php.net to get a copy of this message | ||
From: paolo@mailgate.net
Operating system: Redhat 5.2
PHP version: 4.0 Latest CVS (20/06/2000)
PHP Bug Type: MySQL related
Bug description: mysql_query() queries the last opened link, not the specified link
----------------------------------------------------------------------------
$conn = mysql_connect( 'localhost','infoline','xxxxx');
if (!$conn) print "Error connecting";
$res = mysql_select_db('egg',$conn);
if (!$res) print "Error changing database";
$conn2 = mysql_connect( 'localhost','infoline','xxxxx');
if (!$conn2) print "Error connecting";
$res2 = mysql_select_db('infosat',$conn2);
if (!$res2) print "Error changing database";
$query = 'select * from sat_connections';
$result = mysql_query($query,$conn);
if (!$result) print 'Error doing SQL query: '.mysql_error();
-----------------------------------------------------
The result of all this is an error:
Error doing SQL query: Table 'infosat.sat_connections' doesn't exist
which is true. sat_connections exists in the database 'egg', but not in
the database 'infosat'. This probably means that mysql_query() always
queries the last opened connection, unlike what the documentation
states.
Please note that I am using the first release of PHP4, which does not appear as an option above.
I don't currently have access to the list of compiled modules, etc., but I suspect this is a
general problem. If this is not the case, please mail me and I will get hold of further info.