// set this to the number of results you wish on each page
$limit=20;
// if no offset has been passed, offset should be 0
if (!$offset) $offset=0;
if (!$where) {
if (empty($one) || empty($two)) {
// some error handling as $one and/or
//$two not passed to initial page
}
$where="$one|$two";
}
// NOTE: if a pipe (|) may be in the value
// of $one or $two, use a different delimiter
$data=explode('|',$where);
$query_where="where one='$data[0]' AND two='$data[1]'";
$result=mysql_query("select count(*) from tablename $query_where");
list($numrec)=mysql_fetch_row($result);
#calc num pages
$numpage=intval($numrec/$limit);
if ($numrec%$limit) {
$numpage++; // add one page if remainder
}
$result=mysql_query ("select * from tablename $query_where limit $offset,$limit");
//<!-- HTML headers and other non-relevent stuff -->
if ($numpage>1) {
pagenav();
print "<P>";
}
//<!-- result display loop -->
if ($numpage>1) {
pagenav();
print "<P>";
}