global $PHP_SELF;
$output = "";
// $pageNum starts at 1.
$startRow = ($pageNum - 1) * $rowsPerPage;
$stopRow = $startRow + $rowsPerPage;
for ($i = $startRow; ($i < count($rowResultsArray)) &&
($i < $stopRow); $i++){
$str_result.= "<br>$rowResultsArray[$i]";
//show result
}
$url = "$PHP_SELF?$extraHTMLParms";
$numPages = ceil(count($rowResultsArray) / $rowsPerPage);
if ($pageNum != 1)
$output .= "<a href=\"$url&pageNum="
. ($pageNum-1) . "\">previous</a> "; //
show previous page
for ($i = 1; $i < $numPages+1; $i++){
if ($pageNum == $i) $output .= "<b>$i</b>
"; // show current page
else $output .= "<a href=\"$url&pageNum="
. $i . "\">$i</a> ";
}
if ($pageNum < (int)$numPages)
$output .= "<a href=\"$url&pageNum=" . ($pageNum+1)
. "\">next</a> "; // show next page
return $output.$str_result;