From: scouture at novo dot ca
Operating system: windows 2000
PHP version: 4.3.3
PHP Bug Type: MySQL related
Bug description: mysql_errno() & mysql_error() not behaving right on a second
connection
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 bug report at http://bugs.php.net/?id=26114&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26114&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26114&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26114&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26114&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26114&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26114&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26114&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26114&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26114&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26114&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26114&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26114&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26114&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26114&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26114&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26114&r=float