RE: [PHP] while loop
| From: | Jason Murray | Date: | Tue, 10 Apr 2001 05:48:40 +0000 |
| Subject: | RE: [PHP] while loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47949@lists.php.net to get a copy of this message | ||
> Isn't this suppose to be an infinite loop?
>
> while ($row is assigned to mysql_fetch_array($query)) {
> do stuffs;
> }
>
> someone correct me if I'm wrong?
They key here is that there's a single "=" in the condition.
<?
while ($row = mysql_fetch_array($query))
{
}
?>
... this is actually "while 'row equals the result of
mysql_fetch_array($query)' returns true, do this..."
mysql_fetch_array returns false when you run out of rows.
Jason