#21209 [Bgs]: Error in the examples for mysql_fetch_assoc and mysql_fetch_array

From: Date: Sat, 04 Jan 2003 20:13:21 +0000
Subject: #21209 [Bgs]: Error in the examples for mysql_fetch_assoc and mysql_fetch_array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29058@lists.php.net to get a copy of this message
ID: 21209 User updated by: kyrael@web.de -Summary: mysql_error isn't returning connections problems. Reported By: kyrael@web.de Status: Bogus Bug Type: MySQL related Operating System: Windows PHP Version: 4CVS-2002-12-26 (dev) New Comment: >Unless you use an outdated libmysql, or mysql wasn't installed property >or a valid (default connection) already exists, mysql_error() returns an >errormessage, even if the connection failed. Ah, thats the problem. A MySQL connection is established in the prepend file. Still, that behaviour doesn't make not much sense to me. (Only return errors if no connections are already established) And the manual clearly states that mysql_error uses only open connections, so that should be fixed as well. Previous Comments: ------------------------------------------------------------------------ [2003-01-04 12:23:59] georg@php.net Unless you use an outdated libmysql, or mysql wasn't installed property or a valid (default connection) already exists, mysql_error() returns an errormessage, even if the connection failed. ------------------------------------------------------------------------ [2003-01-04 08:00:51] goba@php.net Michael note that the function states that it gives the error of the last myqsl operation, but the note says on the page: | Note: If the optional argument is specified the | given link is used to retrieve the error message. | If not, the last opened link is used. So it implies, that if the parameter is not given, an opened connection is needed... So the documentation also needs to be changed. Please do not close this bug before the mysql_error documentation is fixed. ------------------------------------------------------------------------ [2003-01-04 05:23:49] nicos@php.net Are you using the bundled version of MySQL, if not, which version? I can't reproduce the bug in any of my systems. Anyway changing this to a MySQL bug, and will see if it is verified. ------------------------------------------------------------------------ [2003-01-03 23:54:27] michael.mauch@gmx.de The manual states that mysql_error() without arguments retrieves the error text of the last recently used MySQL function - _not_ the last opened connection. And that's exactly what happens at least here on Linux (tested with 4.3.0 and 4.4.0-CVS as of today). So if the example doesn't work on Windows, it is broken on Windows. Can you try the example on its own, without your custom error handler? ------------------------------------------------------------------------ [2003-01-03 20:37:16] kyrael@web.de That is not true. Your code just produces a ``Could not connect: '' here. PHP Version 4.4.0-dev System Windows NT localhost 5.1 build 2600 Build Date Dec 26 2002 20:10:08 Server API Apache ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21209 -- Edit this bug report at http://bugs.php.net/?id=21209&edit=1

« previous php.bugs (#29058) next »