//1:定义每条多少页 $page=4; //2:获取数据总条数 $len=sqlsrv_num_rows($result); //3:得到总页数 $prgeall=(int)ceil($len/$page); //4:获取当前页 $dpage=$_GET['page']?? 1; //5:处理上一页 $prepage=$dpage-1<=1?1:($dpage-1); //6:处理下一页 $nextpage=$dpage +1>=$prgeall ? $prgeall:($dpage+1); //$num=($dpage-1)*$page; //7:数据处理 //mssql_data_seek($result,($dpage-1)*$page); //$offset=($dpage-1)*$page; //$start = $offset; //$pagesize = $page; //$sqls = "select top $pagesize o.*from ($result) as o where id not in(select top $start id from ($result) as oo order by id asc) order by id asc" ; //$result=array_slice($result,$num,$page,true);
你如果当前$_GET['page']取不到值,那就要看看你前端页面有没有传入page这个值
数据库用得MSSQL