ID: 26114
User updated by: scouture at novo dot ca
Reported By: scouture at novo dot ca
Status: Open
Bug Type: MySQL related
Operating System: windows 2000
PHP Version: 4.3.3
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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