require '../inc/conn.php';
?>
//Initial parameter setting
$pagesize=5 ; //Page size
$pagenum=1; //The default is the first page
//Step 1: Get the current page
if($_GET){
if($_GET['pagenum']){
$pagenum=$_GET['pagenum'];
}
}
//Step 2: Get the content of the current page List
$sql="Select * From message limit ".($pagenum-1)*$pagesize.",$pagesize ";
$result=mysql_query($sql);
while(($row=mysql_fetch_array($result))==true){
echo '
'.$row["title"].'';
}
//Step 3: Get the number of records
$sql="Select id From message";
$result=mysql_query($sql);
$rownum=mysql_num_rows($result );
//Step 4: Count the number of pages
if(($rownum%$pagesize)==0){
$pagecount=$rownum/$pagesize;
}else{
$pagecount=(int)($rownum/$pagesize);
}
//Step 5: Get the paging link
$url=$_SERVER[" REQUEST_URI"];
$url=parse_url($url);
$url=$url["path"];
//Step 6: Output pagination link
if($pagenum==1){
echo "[First page] [Previous page]";
}else{
echo "[
First page] [
Previous page]";
}
if($pagecount==$pagenum){
echo "[next page] [last page]";
}else{
echo " [
Next page] [
Last page]";
}
?>
http://www.bkjia.com/PHPjc/323833.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323833.htmlTechArticle?php require '../inc/conn.php'; ? ?php //Initial parameter setting $pagesize =5; //Paging size $pagenum=1; //Default is the first page //Step one: Get the current page if($_GET){ if($_GET...