php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30137 php losts one of two mysql links
Submitted: 2004-09-17 19:55 UTC Modified: 2005-12-16 11:02 UTC
Votes:3
Avg. Score:3.7 ± 1.9
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sh4dow at php dot pl Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.0.1 OS: Win2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sh4dow at php dot pl
New email:
PHP Version: OS:

 

 [2004-09-17 19:55 UTC] sh4dow at php dot pl
Description:
------------
when i try to make 2 difrent connection to the mysql, php lost one of them, and all query are making by only one connection. Where is the second ?

Reproduce code:
---------------
$link1 = mysql_connect('localhost', 'user1', '***') or die(mysql_error());
mysql_select_db('baza1', $link1) or die(mysql_error());
$link2 = mysql_connect('localhost', 'user2', '***') or die(mysql_error());
mysql_select_db('baza2', $link2) or die(mysql_error());

$query1 = mysql_query("SELECT * from users LIMIT 0,1", $link1);
while ($r1 = mysql_fetch_assoc($query1)){
    var_dump($r1);
}

$query2 = mysql_query("SELECT * from users LIMIT 0,1", $link2);
while ($r2 = mysql_fetch_assoc($query2)){
    var_dump($r2);
}

Expected result:
----------------
should be two difrent results

Actual result:
--------------
only one result, the second give an error or null

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-06 07:04 UTC] edink@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip


 [2004-11-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-12-16 10:50 UTC] andreas at fink dot org
Seen this exact  behaviour in 5.0.4

    $db1 = mysql_pconnect($db_server,$db_user,$db_pass);
    mysql_select_db('db1_msg',$db1) or die( "Unable to select database1");

    $db2 = mysql_pconnect($db_server,$db_user,$db_pass);
    mysql_select_db('db2',$db2) or die( "Unable to select database2");

...

$res = mysql_query($sql,$db1);


the query is not done on database "db1" as expected but on "db2"

This problem is existing in 5.1.1 too
 [2005-12-16 11:02 UTC] tony2001@php.net
Can't reproduce.
You're definitely doing something wrong.
Look at SHOW TABLES output and you'll see that the databases are different.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC