Isn't the '=' operator suppose to be used for assigning and not for
evaluation.

I thought '==' should be used in this context?

Zeus
----- Original Message -----
From: David Robley <[EMAIL PROTECTED]>
To: Zeus <[EMAIL PROTECTED]>; Michael Hall <[EMAIL PROTECTED]>; Jacky
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, 10 April, 2001 1:53 PM
Subject: Re: [PHP] while loop


> On Tue, 10 Apr 2001 15:16, Zeus wrote:
> > > $query = mysql_query("some SQL here");
> > > while ($row = mysql_fetch_array($query)) {
> > > do stuff;
> > > }
> >
> > 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?
> >
> > Zeus
>
> Consider yourself corrected :-) mysql_fetch-array returns an array
> corresponding to the fetched row, or _false if there are no more rows_
>
> So as soon as there are no more rows, $row = mysql_fetch_array($query)
> evaluates to false and the while exits.
>
> --
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to