You can get the page number and just do a query on that page using the mysql limit function.
So
CODE
$num_of_records = 30; //the number of things you want to show on a page
if($_GET['page']){
$page = $_GET['page'];
}
else{
$page = 0;
}
$start = $page * num_of_records;
$end = $start + num_of_records;
if($start > 0){
$start = $start + 1; //this is for the offset on pages not starting with 0
}
$sql = 'SELECT * FROM SomeTable WHERE name = ' . $query . ' LIMIT ' . $start . ', ' . $end;
//do query and stuff...
I haven't tested that code, but it should work/should be what you're trying to do.
Also you should read up on pagination (that's what this is), which might give you a better way of solving this problem.
Edit:
Also the links to next and previous should be generated by using the current page number. So generate the link with ?page=<? $page-1 ? for prev and ?page=<? $page + 1 ?> for next
This post has been edited by spullen: 25 Mar, 2008 - 12:51 PM