With most db driven websites the output on the first page is limited to the first 15 or 20 records.
This obviously loads the page quicker and puts less strain on the server
I want to do the same, but am not sure how to do it.
The first page is easy of course just using a counter but for subsequent pages
how do I restart the reading rows from where it left off ?
If, for the sixth page, I have to read the first 100 rows, won’t it slow things down?
Do people use markers ? Or can you just tell mysql to start at row 100 and go for
another 20 rows i.e. put in a range ?
Notice that I have an ORDER which is selected y the user.
My coding looks like this:
$sql = “SELECT * FROM stuff ORDER BY $sorter”;
$result = mysql_query($sql)
or die (“Could not 1st execute query.”);
$top = 190; // this is for positioning on the screen
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
extract($row);
require(“stuff_list.php”); // this program displays the row
$top = $top + 30;
}