php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23661 mysql_fetch_array
Submitted: 2003-05-16 13:08 UTC Modified: 2003-05-16 14:07 UTC
From: rodrigo at euforia dot com dot br Assigned: derick (profile)
Status: Closed Package: MySQL related
PHP Version: 4.3.2RC3 OS: ALL
Private report: No CVE-ID: None
 [2003-05-16 13:08 UTC] rodrigo at euforia dot com dot br
Hi,
If you use other param then MYSQL_ASSOC, MYSQL_NUM or MYSQL_BOTH in mysql_fetch_array, the function return an array with size of num records but with blank values.
This isn't an true bug. But is dificult to user discover where he mistake.
If the function only accept this params why not mysql_fetch_array don't return some error message when other params are used?

In older version of PHP this not happend

Kind Regards,
Rodrigo Mour?o
From Brasil

<?
$dbhost = "127.0.0.1";
$dbuser = "root";
$dbpasswd = "";
$database = "test";
$db = mysql_connect($dbhost, $dbuser, $dbpasswd);
mysql_select_db($database, $db);
$sql = "SELECT * FROM any";
$result = mysql_query($sql,$db);
print "<b>".mysql_num_rows($result)." registros</b><br><hr>";
while ($r = mysql_fetch_array($result,$sql)){
	foreach ($r AS $campo=>$value){
		print $campo."=".$value."<br>";
	}
	print "<hr>";
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-16 13:50 UTC] derick@php.net
will check this
 [2003-05-16 14:07 UTC] derick@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC