This blog contains information regarding PHP,HTML, CSS, AJAX, JQUERY AND EXTJS.
Thursday, April 8, 2010
paging in PHP
$count_rec=400; //give here the total number of records
if($count_rec>0) {
$total_pages=ceil($count_rec/20);
$page=$_REQUEST['page'];
$start=($page-1)*20+1;
$end=$start+19;
$x=$start;
//foreach ($photosetList[photoset] as $setList) {
//$sizes = $f->photos_getSizes($setList[primary]);
if($end%$x<=19) {
echo "";
}
//}
}
echo "
";
if($end>$count_rec)
{
$end=$count_rec;
}
if($page==1)
{
echo "<<";
}else
{
$back=$page-1;
?>
<a class="anchorlink" href="pagingPhp.php?page="><<<</a>
$val=ceil($count_rec/20);
echo "Page :- ".$_REQUEST['page'];
if($page==$val)
{
echo " >>";
}else
{
$next=$page+1;
?>
<a class="anchorlink" href="pagingPhp.php?page=">>></a>
Subscribe to:
Post Comments (Atom)
Thanks! this is cool...
ReplyDelete