note 57731 rejected from control-structures.while by tularis
| From: | tularis@php.net | Date: | Wed, 12 Oct 2005 16:05:29 +0000 |
| Subject: | note 57731 rejected from control-structures.while by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96902@lists.php.net to get a copy of this message | ||
Note Submitter: brownerg AT gmail DOT com
----
The while loop below recurses infinitely and simply returns the first result each time:
$sqlResult = mysql_query("select column1 from user")
$arrayHandle = mysql_fetch_array($mysqlResult, MYSQL_NUM);
while ($record=$arrayHandle) {
print $record[0]."\n";
}
The funny thing is if you pass the Handle straight to the while condition, it works properly!
$sqlResult = mysql_query("select column1 from user")
while ($record=mysql_fetch_array($mysqlResult, MYSQL_NUM)) {
print $record[0]."\n";
}
weird! (using php 4.4.3)