Bug #8634 Updated: problem with multiple mysql links mysql_connect mysql_close
| From: | sebastian@php.net | Date: | Sun, 12 Aug 2001 19:25:35 +0000 |
| Subject: | Bug #8634 Updated: problem with multiple mysql links mysql_connect mysql_close | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-63008@lists.php.net to get a copy of this message | ||
ID: 8634
Updated by: sebastian
Reported By: AndrewL@cymatrixresearch.com
Old Status: Critical
Status: Closed
Bug Type: MySQL related
Operating System: FreeBSD 4.2
PHP Version: 4.0.4
New Comment:
fixed in 4.0.6
Previous Comments:
------------------------------------------------------------------------
[2001-05-30 22:26:02] sniper@php.net
Reproduced under PHP 4.0.6RC1
Marked as fix before release.
--Jani
------------------------------------------------------------------------
[2001-01-10 08:09:46] AndrewL@cymatrixresearch.com
<HTML><BODY>
<?php
//im sure you can figure out
//what you need to change to make it work on your sql server =)
echo "<B>Open first link</B><BR>\n";
$db = mysql_connect("10.0.0.1", "bob", "smith");
mysql_select_db("mysql",$db);
echo "<BR><B>Query First link</B><BR>\n";
$result = mysql_query("SELECT Host,Db FROM host");
while ($data = mysql_fetch_array($result)) {
echo $data['Host']," db ",$data['Db'],"<BR>\n";
}
echo "<BR><B>open second links and close and continue to use first
links<BR>\n";
echo "This time we will use the link identifiers</B><BR>\n";
$result = mysql_query("SELECT Host FROM host",$db);
$db2 = mysql_connect("10.0.0.1", "bob", "smith");
mysql_select_db("mysql",$db2);
while ($data = mysql_fetch_array($result)) {
$sql = "SELECT Host,Db FROM host WHERE Host =
'".$data['Host']."'";
$result2 = mysql_query($sql,$db2);
$data2 = mysql_fetch_array($result2);
echo $data2['Host']," db ",$data2['Db'],"<BR>\n";
}
mysql_close($db2);
echo "<BR><B>back to the first link or what *SHOULD* be the first link but errors
happen.</B><BR>\n";
$result = mysql_query("SELECT Host,Db FROM host");
while ($data = mysql_fetch_array($result)) {
echo $data['Host']," db ",$data['Db'],"<BR>\n";
}
echo "<BR><B>And finaly use the first link identifier and it
works</B><BR>\n";
$result = mysql_query("SELECT Host,Db FROM host",$db);
while ($data = mysql_fetch_array($result)) {
echo $data['Host']," db ",$data['Db'],"<BR>\n";
}
?>
<BR><B>Final note: This worked just fine before I upgraded from aprox 4.0.3p12 or
something.
I was able to call mysql_query after a mysql_close on a second link the switching back to
the first link happend automaticly.</B><BR>
</BODY></HTML>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=8634&edit=1