Nobody seems to answer!!
Here's one way I found:
Firstly, decide if you are going to query the database once or multiple times as needed. The best idea is to query once and cache everything (should only be strings anyway - try use a session variable) - unless your cache is slow (see *). With minimal load (<20 users at once), it's not much of an issue.
With the array from your query, take the first n results and list them. Save the array in $_SESSION (*). Now for your row of HTML links, you are going to pull data from that array in groups of n. All you need to do is pass a variable ($offset) with each link. At the top of the page, if $offset equals anything above n, proceed with pulling from the array the next n elements (with a loop) past the value of $offset from the array and print them. For the link titled "2", pass $offset=2*n, for "3", $offset=3*n.
*$_SESSION is known to be slow because it writes to the server drive. You can use virtual drives (in RAM) or a RAID array to lessen the problem. Others simply place the data in MySQL (perhaps a temporary table).
Consider just querying the database again instead of using $_SESSION. In this case, you could use $offset in your SQL query (after checking $offset to deter tampering) or simply query everything again and use $offset to select the block of current block of results. Either way, every page you make a new query and select your results based on $offset.
This article appears to present a similar solution.
[http://www.phpbuilder.com/columns/rod20000221.php3]
_________________
Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.