Display second record in table, third record in table, etc.
Posted: Thu Jan 08, 2009 2:14 pm
Using mySQL and PHP I want to select the records from my table and then display the second most recent record (based on a field in that table, like postID or date, whetaver) on the web page.
For example, suppose I have a table called blogPosts and the fields are postID, title, blurb, and post ... In that table I have 50 records, with the postID being incremental from 1-50. 50 is the most recent post. How can I select the record with the postID of 49 (or whatever record is the second in descending order) ? Furthermore, can I select the 3rd highest and 4th highest, etc.?
Thanks
For example, suppose I have a table called blogPosts and the fields are postID, title, blurb, and post ... In that table I have 50 records, with the postID being incremental from 1-50. 50 is the most recent post. How can I select the record with the postID of 49 (or whatever record is the second in descending order) ? Furthermore, can I select the 3rd highest and 4th highest, etc.?
Thanks