Re: while loop
| From: | Jack Dempsey | Date: | Tue, 10 Apr 2001 06:50:51 +0000 |
| Subject: | Re: while loop | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-47967@lists.php.net to get a copy of this message | ||
Zeus wrote:
>
> That was detailed :)
>
> Thanks Jack, it fixed my misconception of the = and == operators.
>
> BUT ...
>
> > mysql_fetch_array keeps track of where it is in the array.
> > after each while loop it moves a 'step ahead' in the result
>
> the mysql_fetch_array fetches the results in an array but should it be an
> one time affair ?
hey,
i'm not sure i follow the 'should it be an one time affair' question...
if should be a X time affair, where X is the amount of rows returned
from mysql.
if you're wondering about the = and it being a 'one time' thing...well,
it is, but since its stuck in a while loop, it used 'once' again and
again...if that's not TOO confusing...
i think of it the same way as something like this:
$count=0;
while($count++<10){
echo "count is $count";
}
the increment operater is a 'one time' operation, but used in a loop,
it'll keep going...
same if you had this...
while(($count+=1)<10){
echo "count is $count";
}
(except of course the second loop cuts off before 10...)
this help?