PHP implementation of data paging display function, PHP implementation of pagination display
The example of this article for everyone to share the data page display function PHP implementation code for your reference, the specific content as follows
Implementation code:
<title>User List</title><?php $con = mysql_connect ("localhost", "root", ""); mysql_query ("Set names UTF8"); mysql_select_db ("Zhiye", $con); $pageSize = 1; The number of displays per page $rowCount = 0; To get $pageNow = 1 from the database; Number of pages currently displayed//if there is pagenow to use, there is no default on the first page. if (!empty ($_get[' Pagenow ')) {$pageNow = $_get[' Pagenow ']; } $pageCount = 0; Represents the total number of pages $sql 1 = "SELECT count (ID) from user"; $res 1 = mysql_query ($sql 1); if ($row 1=mysql_fetch_row ($res 1)) {$rowCount = $row 1[0]; }//Calculate total number of pages, ceil 1 $pageCount = ceil (($rowCount/$pageSize)); When using SQL statements, be aware that some variables should be assigned values. $pre = ($pageNow-1) * $pageSize; $sql 2 = "SELECT * from User limit $pre, $pageSize"; $res 2 = mysql_query ($sql 2); while ($row =mysql_fetch_assoc ($res 2)) {echo $row [' user_name ']. "
"; echo $row [' name ']. "
"; echo $row [' email '].
"; echo $row [' Password ']. "
"; Echo $row [' Tel '].
"; } for ($i =1; $i <= $pageCount; $i + +) {echo "$i"; }?>
The above is the whole content of this article, I hope to give you a reference, but also hope that we support a lot of help the home.
http://www.bkjia.com/PHPjc/1133085.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133085.html techarticle based on the PHP implementation of data paging display, PHP implementation of the page shows the example of this article to share the data page display function PHP implementation code for your reference, the concrete content as follows ...