Re: Q: while loop on an array
| From: | Jeff Bearer | Date: | Wed, 23 Jan 2002 22:42:15 +0000 |
| Subject: | Re: Q: while loop on an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81785@lists.php.net to get a copy of this message | ||
check out the foreach control structure it may be exactly waht you need.
http://www.php.net/manual/en/control-structures.foreach.php
On Wed, 2002-01-23 at 10:17, Joe Rice wrote:
>
> Hello,
>
> I would like to know how i can know when i'm at the
> end of an array during a while loop?
>
> reset($new_answers);
> while (list($new_qID,$new_aID) = each ($new_answers)) {
> $sql .= "qID=\"$new_qID\ ||" ";
> }
> $sql .= ") AND uID = \"$uID\"";
>
> i would like to know how to stop putting the " || " at
> the end of $sql in the middle of the while loop.
>
> any help would be appreciated.
>
> thanks,
> joe
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
Jeff Bearer, RHCE
Webmaster
PittsburghLIVE.com