[PHP-BUG] Bug #51602 [NEW]: mysql link looses database selection with multiple links

[email protected] ("courtois at nouvo dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: debian lenny
PHP version:      5.2.13
Package:          MySQL related
Bug Type:         Bug
Bug description:mysql link looses database selection with multiple links

Description:
------------
when using 2 databases at the same time with 2 links, database selection is
lost.

Test script:
---------------
<?php

  $db1 = mysql_connect("localhost","user1","pass");
  mysql_select_db("database1",$db1);

  $db2 = mysql_connect("localhost","user2","pass");
  mysql_select_db("database2",$db2);


  if(!(mysql_query("select * from mytable",$db1)))
       print "error:".mysql_error();
     else
       print "ok";
?>

Expected result:
----------------
should print "ok" 
works fine with windows (builtin mysql) but not with debian lenny

Actual result:
--------------
error:Table 'database2.mytable' doesn't exist

the select is done on database2 although database1 was selected on the $db1
link.


-- 
Edit bug report at http://bugs.php.net/bug.php?id=51602&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51602&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51602&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51602&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51602&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51602&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51602&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51602&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51602&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51602&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51602&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51602&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51602&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51602&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51602&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51602&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51602&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51602&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51602&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51602&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51602&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51602&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.