Page 1 of 1

Identify the first and last row of a loop

Posted: Fri Mar 14, 2008 4:39 am
by xodus
Hi all
How can I identify the first and last row of a while loop?
This would help me to swap images related to the first and last row.
Thank you.

Re: Identify the first and last row of a loop

Posted: Fri Mar 14, 2008 4:40 am
by s.dot
Well, if you are counting the rows, the first will always be row 1, and the last will always be the number of rows (mysql_num_rows() on a result set, count() on an array).

Re: Identify the first and last row of a loop

Posted: Fri Mar 14, 2008 5:02 am
by xodus
Thank you so much Scot, will work on it.