//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);
If you cannot get the value of $_GET['page'] currently, then you need to check whether your front-end page has passed in the value of page
The database uses MSSQL