Click to See Complete Forum and Search --> : paging comments


XeroSiS
04-15-2006, 08:41 AM
I wanted to know what the query would be fi I want to show the comments by page? .. I know how to find out howmany pages are needed and all that, I was wondering what the query would be ... for example:

I have 100 comments, and I would like each page to show 20 comments, so if in my address par the page is on 3, that means I want to show comments 41-60. what should my query be?

XeroSiS
04-15-2006, 12:43 PM
help?

aaronbdavis
04-15-2006, 12:58 PM
$sql = "SELECT * FROM comments LIMIT $startRecord, $numRecords

$startRecord is the record to start with (keeping in mind that MySQL counts starting at 0, not 1) and $numRecords is the number of record you want to show.

For your example, you would need to set $startRecord = 40;
$numRecords = 20;