";
// Begin Prev/Next Links
// use urlencode to allow prev/next buttons to work in Netscape
$par_new=urlencode($par);
// Don't display PREV link if on first page
if ($offset!=0) {
$prevoffset=$offset-$limit;
echo "PREV $limit \n";
}
// Calculate total number of pages in result
$pages = intval($totalrows/$limit);
// $pages now contains total number of pages needed unless there is a remainder from division
if ($totalrows%$limit) {
// has remainder so add one page
$pages++;
}
// Now loop through the pages to create numbered links
// ex. 1 2 3 4 5 NEXT
for ($i=1;$i<=$pages;$i++) {
// Check if on current page
if (($offset/$limit) == ($i-1)) {
// $i is equal to current page, so don't display a link
echo "$i ";
} else {
// $i is NOT the current page, so display a link to page $i
$newoffset=$limit*($i-1);
echo "$i \n";
}
}
// Check to see if current page is last page
if ($totalrows==0) {
print "

No records found for $par Parish.

";
}
elseif (!((($offset/$limit)+1)==$pages) && $pages!=1) {
// Not on the last page yet, so display a NEXT Link
$newoffset=$offset+$limit;
echo "NEXT $limit