You don't need to know when you hit the end.  Rather, simply remove the last
|| after the completion of the loop.

 while (list($new_qID,$new_aID) = each ($new_answers)) {
        $sql .= "qID=\"$new_qID || \"";
 }
 $sql .= substr( $sql, 0, -3) .") AND uID = \"$uID\"";



-----Original Message-----

"Joe Rice" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
>
> 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: [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]

Reply via email to