ID: 26114
User updated by: scouture at novo dot ca
Reported By: scouture at novo dot ca
Status: Bogus
Bug Type: MySQL related
Operating System: windows 2000
PHP Version: 4.3.3
New Comment:
Have you been able to reproduce the behavior with the new_link
parameter set to TRUE like I did ?
Previous Comments:
------------------------------------------------------------------------
[2003-11-04 10:27:52] scouture at novo dot ca
I've got the same result EVEN with the new_link parameter set to TRUE.
echo "first connection<br><br>";
$conn1 = mysql_connect($validIp&Port,$validUser,$validPassword,
true);
if($conn1 == false)
{
echo "<hr>mysql_error : ".mysql_error()."<br>";
echo "mysql_errno : ".mysql_errno()."<hr>";
}
else
echo "ok connected 1";
echo "<hr>second connection<br><br>";
$conn2 = mysql_connect ($validIp&Port,$validUser,$NOTvalidPassword,
true);
if($conn2 == false)
{
echo "<hr>mysql_error : ".mysql_error()."<br>";
echo "mysql_errno : ".mysql_errno()."<hr>";
}
else
echo "ok connected 2";
------------------------------------------------------------------------
[2003-11-04 09:58:34] [EMAIL PROTECTED]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
Always use the link parameter when doing multiple connects in same
scripts. This is no bug.
------------------------------------------------------------------------
[2003-11-04 09:45:51] scouture at novo dot ca
NOTE that mysql_error() & mysql_errno() are returning result has
expected if the first connection failed. So, if the first connection
and the second failed, both mysql_error() & mysql_errno() are ok for
the first and the second connection.
But, if there is already a valid connection to the dbserver, they are
not behaving right for the second in case of failling.
Hope that is clear enought...
Regards
------------------------------------------------------------------------
[2003-11-04 09:39:44] scouture at novo dot ca
Description:
------------
When openning 2 connections to a MySQL server using mysql_connect or
mysql_pconnect, if the first connection is valid and the second not (in
my code, the password for the second connection is wrong), then
mysql_error() return an empty string and mysql_errno return 0 witch is
the errno saying that there has been no problem.
Reproduce code:
---------------
echo "first connection<br><br>";
$conn1 = mysql_connect($validIp&Port,$validUser,$validPassword);
if($conn1 == false)
{
echo "<hr>mysql_error : ".mysql_error()."<br>";
echo "mysql_errno : ".mysql_errno()."<hr>";
}
else
echo "ok connected 1";
echo "<hr>second connection<br><br>";
$conn2 = mysql_connect ($validIp&Port,$validUser,$NOTvalidPassword);
if($conn2 == false)
{
echo "<hr>mysql_error : ".mysql_error()."<br>";
echo "mysql_errno : ".mysql_errno()."<hr>";
}
else
echo "ok connected 2";
Expected result:
----------------
mysql_error should be
Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)
mysql_errno should be
1045
Actual result:
--------------
/**display**/
first connection
ok connected 1
--------------------------------------------------------------------------------
second connection
Warning: mysql_connect(): Access denied for user: '[EMAIL PROTECTED]'
(Using password: YES) in D:\Program Files\Apache
Group\Apache2\htdocs\Intranet Novolog\tesMysql.php on line 20
--------------------------------------------------------------------------------
mysql_error :
mysql_errno : 0
--------------------------------------------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26114&edit=1