php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #695 mysql_error can't fetch the error afte the database connection is closed
Submitted: 1998-08-25 22:06 UTC Modified: 1998-09-02 13:33 UTC
From: mlemos at acm dot org Assigned:
Status: Closed Package: MySQL related
PHP Version: 3.0.3 OS: Any
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: mlemos at acm dot org
New email:
PHP Version: OS:

 

 [1998-08-25 22:06 UTC] mlemos at acm dot org
If for some reason you want to fetch the error of a failed operation
but you close the connection before fetching the error mysql_error says
that that the connection link is invalid.

The following script shows that provided that the example user xpto is not
authorized to access the database mysql.

BTW, the error message says user @localhost is not authorized.  Shouldn't
it say user xpto@localhost is not authorized?

<?
	if(($link=mysql_pconnect("localhost","xpto","")))
	{
		if(($select=mysql_select_db("mysql"))==0)
			echo mysql_error();
		mysql_close($link);
	}
	echo mysql_error();
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-09-02 13:33 UTC] zeev
That's correct, and is the intended and planned behavior.

About the error message, it's coming from the MySQL server,
and some versions had buggy response strings.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC