Identify the first and last row of a loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
xodus
Forum Newbie
Posts: 6
Joined: Wed Mar 12, 2008 2:49 am

Identify the first and last row of a loop

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Identify the first and last row of a loop

Post 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).
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
xodus
Forum Newbie
Posts: 6
Joined: Wed Mar 12, 2008 2:49 am

Re: Identify the first and last row of a loop

Post by xodus »

Thank you so much Scot, will work on it.
Post Reply