Guestbook previous 10/next 10
| From: | James Taylor | Date: | Thu, 21 Mar 2002 20:44:51 +0000 |
| Subject: | Guestbook previous 10/next 10 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89585@lists.php.net to get a copy of this message | ||
I have this sort of guest book that only will display 10 entries on the page
at a time, after that you have the option of previous 10, and if you're not
on the front page you also have next 10. I'm getting the ID of the VERY LAST
POST listed on the page. So it's doing something like
while ($myrow = mysql_fetch_row($result)) {
$pid = $myrow[0];
print the post
}
$result = mysql_query("select * from posts limit $pid, 10", $db);
Well, it seems to KIND of work, the only thing is that the ID's aren't
necessarily sequential. If I delete a post, well, that ID is now missing,
and when you click 'previous', it's displaying a couple of duplicate posts
that were on the page before it.
Any idea on a way to get around this?