Pagination Upgrade

Hello,

Please refer to my older threads regarding pagination. I have now added a back and next button to the code.

<?php if ($totalRows_Recordset_paging > $number_per_page) {

// this is my display
$i = 1;

// this is for the BACK button (next 5 lines)
if($whichpage == 1) { } else {
    $previouspage = $whichpage – 1;
   echo “<a href=brand_new.php?dept=” . $dept . “&whichpage=” . $previouspage . “><<></a>>”;
}

while ($i <= $amountofpages):

if($whichpage == $i) {
    echo “” . $i. “”;
} else {
    echo “<a href=brand_new.php?dept=” . $dept . “&whichpage=” . $i . “>” . $i. “</a>”;
}

$i++;
endwhile;

// this is for the NEXT button (next 5 lines)
if($whichpage == $amountofpages) { } else {

    $nextpage = $whichpage + 1;
    echo “<a href=brand_new.php?dept=” . $dept . “&whichpage=” . $nextpage . “>NEXT >></a>”;

}

?>