php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32798 mysql_error doesn't work correctly with two mysql_connects
Submitted: 2005-04-22 00:34 UTC Modified: 2005-04-23 19:15 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: wkonkel at mindshare dot net Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.10 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wkonkel at mindshare dot net
New email:
PHP Version: OS:

 

 [2005-04-22 00:34 UTC] wkonkel at mindshare dot net
Description:
------------
I have found the same problem as this bogus bug (it's not bogus though):

http://bugs.php.net/bug.php?id=26114

This is still an issue in 4.3.10 and is not bogus.  You cannot pass $link2 as a parameter to mysql_error becuase upon a failed connection, $link2 is false.  How do you get the errno/error?

Reproduce code:
---------------
Scenario 1: 
$link1 = @mysql_connect("localhost","user","pass");
$link2 = @mysql_connect("blah","user","pass") or die("error: " . mysql_errno() . " -- " . mysql_error());

Scenario 2:
//$link1 = @mysql_connect("localhost","user","pass");
$link2 = @mysql_connect("blah","user","pass") or die("error: " . mysql_errno() . " -- " . mysql_error());



Expected result:
----------------
Scenario 1:
error: 2005 -- Lost connection to MySQL server during query 

Scenario 2:
error: 2005 -- Lost connection to MySQL server during query 


Actual result:
--------------
Scenario 1:
error: 0 -- 

Scenario 2:
error: 2005 -- Lost connection to MySQL server during query 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-22 00:38 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2005-04-23 19:15 UTC] sniper@php.net
.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC