-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, October 27, 2011 8:00 PM
To: [email protected]
Subject: [PHP-DB] Simple MySQL sample code runs out of memory
Running PHP 5.3.5 on FreeBSD 8.2 connecting to a MySQL 5.1.55 server.
<snip>
$row = mysql_fetch_array( $result );
while ($row) {
...
</snip>
Your while() condition will always be true, so that loop will run forever.
Until you run out of memory.
What you probably meant was to replace those two lines with something like
this:
while($row = mysql_fetch_array( $result ) ) {
A new row is fetched each time the while loop goes through another
iteration, until you run out of rows and the condition evaluates to false.
Toby
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php