From: admin at shadyindustries dot biz
Operating system: Windows XP and Unix
PHP version: 4.4.7
PHP Bug Type: MySQL related
Bug description: mysql_fetch_array returns empty array
Description:
------------
mysql_fetch_array and mysql_fetch_assoc return empty arrays when, for the
same query, mysql_num_rows returns 5 - the correct number.
also notable, the mysql_affected_rows causes a server malfunction for the
same query.
I have tested it both on my
public webserver (unix, unknown webserver, PHP 4, MySQL 4) and my home
computer (Windows XP, Apache2, PHP 5, MySQL 5),
thus this problem would appear to not be related to just one
circumstance.
The really weird thing is that phpMyAdmin can read the database perfectly.
Reproduce code:
---------------
<?php
$con = mysql_connect("####" ,"####" ,"####");
if (!$con) {
trigger_error("Unable to connect to mysql, MYSQL ERROR:
" .
mysql_error(),E_USER_ERROR);
}
if (!mysql_select_db("NuevasIslas", $con)) {
trigger_error("Unable to open database, MYSQL ERROR: " .
mysql_error(),E_USER_ERROR);
}
while($row = mysql_fetch_array(mysql_query("SELECT * FROM
`jaydev_config`"))) {
$config[$row['name']] = $row['value'];
}
print "$config";
//print mysql_fetch_array(mysql_query("SELECT * FROM `jaydev_config`"));
?>
Expected result:
----------------
Array
(
[enabled_login] => 0
[enabled_register] => 1
[server_name] => JayDev
[url_base] => http://ni.shadyindustries.biz/jaydev/
[url_forum] => http://forum.shadyindustries.biz/viewforum.php?f=4
)
Actual result:
--------------
Array
--
Edit bug report at http://bugs.php.net/?id=41303&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41303&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41303&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41303&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41303&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41303&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41303&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41303&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41303&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41303&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41303&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41303&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41303&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41303&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41303&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41303&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41303&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41303&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41303&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41303&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41303&r=mysqlcfg