ID: 41303
Updated by: [EMAIL PROTECTED]
Reported By: admin at shadyindustries dot biz
Status: Bogus
Bug Type: MySQL related
Operating System: Windows XP and Unix
PHP Version: 4.4.7
New Comment:
That's because the while statement is never going to end, you'll re-run
the query on each iteration of the loop.
Previous Comments:
------------------------------------------------------------------------
[2007-05-07 09:39:33] admin at shadyindustries dot biz
(sorry for the double post)
i believed the fact it was an "empty" array was causeing the problem,
though, evidently it is not.
the ACTUAL problem is that the while statement causes the script
execution to come to a standstill - no errors, it just times out.
------------------------------------------------------------------------
[2007-05-07 09:36:19] admin at shadyindustries dot biz
yes, you were right, it should be print_r, however, that does not fix
the actual problem.
the While statement causes a server malfunction.
------------------------------------------------------------------------
[2007-05-07 03:07:15] [EMAIL PROTECTED]
.
------------------------------------------------------------------------
[2007-05-07 01:50:41] dayseye at 21cn dot com
should print() be print_r() ?
------------------------------------------------------------------------
[2007-05-06 12:25:47] admin at shadyindustries dot biz
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 this bug report at http://bugs.php.net/?id=41303&edit=1