/*====对数据的记录进行分页显示=====一张页面有连续的十个页面的连接一页可显示$limit_row条记录信息并有下十页和上十页翻页功能===================================
------需传入值$total_row;$limit_row;$pagename;-----$total_row为所选查询结果的总行数$limit_row为每页显示的最大行数$pagename为返回显示页面名称。(不带后缀名)----------------------------------------------------
----------------------------------------------------$page当前所读页面$total_page为共可分为几页.$row_begin为从第几行开始读$row_end为读到第几行为止-----------------------------------------------------*/
if (!$page){ $page=1;}$total_page=ceil($total_row/$limit_row);$row_begin=$limit_row*($page-1);if($page==$total_page&&($total_row%$limit_row)){$read_row=($total_row%$limit_row);}else{$read_row=$limit_row;}if($total_page<=10){$page_begin=0;$page_end=$total_page;$page10=1;$newpage10=1;}else{//--------------分页显示下十页----------------// $page10为总共有几个十页// $newpage10为读十页的起始位置// $page_endx为读取最后的页数
$page10=ceil($total_page/10);if($newpage10 ==""){$newpage10=1;}$page_begin=10*($newpage10-1);if($newpage10==1){if($newpage10==($page10-1)&&($total_page%10)){$page_endx=$total_page%10;$page_end=10;echo "| 最前十页 | |";}else{$page_end=10;echo "| 已是最前十页 | |";}}elseif($newpage10>1){if($newpage10==$page10&&($total_page%10)){$page_end=$total_page%10;echo "| |已是最后 $page_end 页|";}else{if($newpage10==($page10-1)&&($total_page%10)){ $page_endx=$total_page%10;$page_end=10;echo "| | |";} else{$page_end=10;echo "| | |";}}
}}
//----------------------每十页页码--------------------------------------echo "总共:".$total_row."条 第 ";for ($n=$page_begin+1;$n<=$page_begin+$page_end;$n++){echo " ";}echo "页";
?>
------需传入值$total_row;$limit_row;$pagename;-----$total_row为所选查询结果的总行数$limit_row为每页显示的最大行数$pagename为返回显示页面名称。(不带后缀名)----------------------------------------------------
----------------------------------------------------$page当前所读页面$total_page为共可分为几页.$row_begin为从第几行开始读$row_end为读到第几行为止-----------------------------------------------------*/
if (!$page){ $page=1;}$total_page=ceil($total_row/$limit_row);$row_begin=$limit_row*($page-1);if($page==$total_page&&($total_row%$limit_row)){$read_row=($total_row%$limit_row);}else{$read_row=$limit_row;}if($total_page<=10){$page_begin=0;$page_end=$total_page;$page10=1;$newpage10=1;}else{//--------------分页显示下十页----------------// $page10为总共有几个十页// $newpage10为读十页的起始位置// $page_endx为读取最后的页数
$page10=ceil($total_page/10);if($newpage10 ==""){$newpage10=1;}$page_begin=10*($newpage10-1);if($newpage10==1){if($newpage10==($page10-1)&&($total_page%10)){$page_endx=$total_page%10;$page_end=10;echo "| 最前十页 | |";}else{$page_end=10;echo "| 已是最前十页 | |";}}elseif($newpage10>1){if($newpage10==$page10&&($total_page%10)){$page_end=$total_page%10;echo "| |已是最后 $page_end 页|";}else{if($newpage10==($page10-1)&&($total_page%10)){ $page_endx=$total_page%10;$page_end=10;echo "| | |";} else{$page_end=10;echo "| | |";}}
}}
//----------------------每十页页码--------------------------------------echo "总共:".$total_row."条 第 ";for ($n=$page_begin+1;$n<=$page_begin+$page_end;$n++){echo " ";}echo "页";
?>