September 07, 2008

php paging

Here is the function which you can paging your data to next or previous
======================================

//$page is refer to the page which you will link to.
//$startnum is refer to the startnumber in limit
//$numrow is refer to the number of record in limit
//$maxrow is the count number of your data
function paging($page,$startnum,$numrow,$maxrow){
if($startnum<=0){
$btnprevious="Previous";
}else{
$btnprevious="<a href=$page?startnum=$startnum-$numrow>Previous</a>";
}
if($startnum+$numrow < $maxrow){
$btnnext="<a href=$page?$startnum+$numrow>Next</a>";
}else{
$btnnext="Next";
}
return $btnprevious."  ".$btnnext;
}

0 comments:


Free Blogspot Templates by Isnaini Dot Com and Porsche Cars. Powered by Blogger