Zeus wrote:
>
> Isn't the '=' operator suppose to be used for assigning and not for
> evaluation.
>
yup.
> I thought '==' should be used in this context?
nope.
Thing is, you ARE assigning. Here's a breakdown of the controlling part
of the loop in english:
--->while ($row = mysql_fetch_array($query)) {
this can be thought of as this:
1. fetch an array from $query, which is a mysql result.
2. assign this value to $row
3. we do this AS LONG AS WE ARE ABLE TO FETCH THE ARRAY.
that's the while part
mysql_fetch_array keeps track of where it is in the array.
after each while loop it moves a 'step ahead' in the result
when it gets to the end, it can't fetch anymore information from your
result.
then it returns false.
thus, it can't assign a value to $row.
thus that statement is false.
therefore the while loop exits
> > > 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]
--
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]