Take a look at mysql_data_seek()


James Taylor wrote:
> I have a really simple guestbook that allows someone to post to the book,
> then it displays all the entries.  Well, there are too many entries now for
> just one page and it looks kinda wacky, so I wanted to do something where it
> only displays 10 entries per page, then there are links for pages say 11-20,
> 21-30, etc.   I have no idea how to do this - I only know how to limit the
> number of entries per page.  So, the script that displays all the entries
> looks something like this:
> $counter = 0;
> $result = mysql_query("select name, post from guestbook order by id desc",
> $db);
> while (($myrow = mysql_fetch_row($result)) && ($counter < 10)) {
>    echo "<TR><TD>$myrow[0]</TD></TR>\n";
>    echo "<TR><TD>$myrow[1]</TD></TR>\n";
>    ++$counter;
> }
> Well, that shows only the latest 10 alright, but what if I wanted to show
> entries 11-20?  I figure I could get the number of posts through
> mysql_num_rows, I just can't piece it all together.  Any suggestions would be
> really helpful.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to