php简单分页
<?php include('conn.php'); $sql = "select id from user"; //$totalsize = totalnums($sql);//计算总的数据条数 $result = mysql_query($sql); $num = mysql_num_rows($result);//总条数 $size=8;//每页要显示的条数 $pageNow=1;//当前页 if (!empty($_GET['pageNow'])){ $pageNow = $_GET['pageNow']; } global $totalPage; $totalPage = ceil($num/$size);//共多少页 $pre = ($pageNow-1)*$size;//当前条数 $sql2 = "select * from user limit $pre,$size"; $res = mysql_query($sql2); /* for ($i=1;$i<=$totalPage;$i++){ echo "<a href='hh.php?pageNow=$i'>$i</a> "; }*/ ?>