$perpagenum = 10;//Define each page display Several pieces
$total = mysql_fetch_array(mysql_query("select count(*) from a"));//Query how many pieces of data there are in the database
$Total = $total[0]; >$Totalpage = ceil($Total/$perpagenum); // Round up and round
if(!isset($_GET['page'])||!intval($_GET['page'])| |$_GET['page']>$Totalpage)//Four possible states of page
{
$page=1;
}
else
{
$page =$_GET['page']; //If the above four conditions are not met, the value of page is $_GET['page']
}
$startnum = ($page-1)*$perpagenum ;//Start number of items
$sql = "select * from a order by id limit $startnum,$perpagenum";//Query the required number of items
echo $sql."
";
$rs = mysql_query($sql);
$contents = mysql_fetch_array($rs);
if($total) If $total is not empty, execute the following statement 🎜> "center"> > ;
name: | //Previous page
$next = $page + 1;//Next page
echo "
There are ".$Total." records, and each page has ".$perpagenum." records, Total ".$Totalpage." pages "; Home";
echo " Previous page ";
}
if($page != $Totalpage)
{
echo " Next page";
echo " Last page";
}
}
else If $total is empty, No message will be output
{
echo "
No message< ;/center>";
}
?>
http://www.bkjia.com/PHPjc/318799.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318799.htmlTechArticleCopy the code as follows: ?php $perpagenum=10;//Define how many items are displayed on each page $total=mysql_fetch_array (mysql_query("selectcount(*)froma"));//Query how many pieces of data there are in the database...