|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 26 01:00:02 2025 UTC |
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