This article shares the PHP implementation code for data pagination display function for your reference. The specific content is as follows
Implementation code:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>User List</title> </head> <body> <?php $con = mysql_connect("localhost","root",""); mysql_query("set names utf8"); mysql_select_db("zhiye",$con); $pageSize = 1; //The number of displayed per page $rowCount = 0; //To get from the database $pageNow = 1; //What page is currently displayed //If there is pageNow, use it, and if there is no page, the first page will be defaulted. if (!empty($_GET['pageNow'])){ $pageNow = $_GET['pageNow']; } $pageCount = 0; //Indicate how many pages there are in total $sql1 = "select count(id) from user"; $res1 = mysql_query($sql1); if($row1=mysql_fetch_row($res1)){ $rowCount = $row1[0]; } //Calculate how many pages there are in total, and ceil takes 1 $pageCount = ceil(($rowCount/$pageSize)); //When using SQL statements, note that some variables should be assigned. $pre = ($pageNow-1)*$pageSize; $sql2 = "select * from user limit $pre,$pageSize"; $res2 = mysql_query($sql2); while($row=mysql_fetch_assoc($res2)){ echo $row['user_name']."<br>"; echo $row['name']."<br>"; echo $row['email']."<br>"; echo $row['password']."<br>"; echo $row['tel']."<br>"; } for ($i=1;$i<=$pageCount;$i++){ echo "<a href='?pageNow=$i'>$i</a>&nbsp;"; } ?> </body> </html>
The above is the entire content of this article. I hope you can give you a reference and I hope you can support me more.