If you are thinking, pre-creating the pages.. Yes you are going about it the wrong way.
The keyword here is build the pages dynamically.
Simply use:
$sql = "SELECT * FROM [database].[table] LIMIT $from, $limit";
So if the user enters:
http://domain/yourpage.php
$limit = empty and $from is also empty. This triggers your script in this way:
if ( $limit == "" && $from == "" ) {
$limit = 50;
$from = 0;
}
[put SQL statement here]
So iniatially, the page would start at row 0 showing 50 results (err.. if I put this right excuse me for being behind a monitor whole day long ;-))
So, your next code on that page might be something like:
(after the above sample code)
$from = $from + $limit;
this will make the starting row, row 50. The limit remains 50 per page.
The url then becomes:
echo "<p><a href=\"yourpage.php?from=$from&limit=$limit\">Show next $limit results</a></p>";
This will result in:
<a href="yourpage.php?from=50&limit=50">
So when the user clicks on the link, just look again at the first example, neither limit, nor from is empty so this code is skipped. It automatically executes your query again, and then adds 50 to the from, which was 50 and now becomes 100, so your new limit is:
LIMIT 100,50
And so on.. and so on...
It's quite a trick this limiting thing, for my forum I had the problem that when a user posted a message, it had to return to the previous page. I didn't want simply a history go back thingy (javascript) but a header("location: bla.php");
Of course it didn't remember where it was, and therefor I used session vars. Before posting, the present position is put into a session var.
Although this is not solid, bullet-proof code, at least it leaves something to your imagination and hopefully get you started.
The magic word always is (in my humble opinion) to modify your SQL statements in such a way that you have little else to do with your code since your rows are presented almost ready to go.