If you need multiple connections, you should store them in variables and
keep track of them.
The "last connection" is a convenience for single-connection users.
Opening a MySQL connection is quite slow, so you really don't want to do it
more than you have to.
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Bob Silva <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 20, 2001 10:48 AM
Subject: Internal use of Mysql Connections
Just curious why mysql wouldnt restore the last known internal connection
id. In the code below, I open a connection (without storing the connection
id), use it, then open,use,close a different connection, this time using a
connection id, but when I close it, the original internal connection id is
history, the last query fails. It would make sense to me that php would
restore the last known connection handle (if there is one) after I call
mysql_close();
I know I could call mysql_connect again after the mysql_close call and that
would restore it.
Any ideas? Thanks, Bob
mysql_connect("hostname", "user", "pass");
$res = mysql_db_query("mlm","select count(*) from mlm_clients");
echo mysql_num_rows($res)."<br>";
$conn = mysql_connect("hostname", "user", "pass");
$res = mysql_db_query("rollcall","select count(*) from rollcall_students");
echo mysql_num_rows($res)."<br>";
mysql_close($conn);
FAILS --> $res = mysql_db_query("mlm","select count(*) from mlm_clients");
echo mysql_num_rows($res)."<br>";
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]