取不出SQL得到的當前頁
問題描述
//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);
問題解答
回答1:你如果當前$_GET['page']取不到值,那就要看看你前端頁面有沒有傳入page這個值
回答2:數據庫用得MSSQL
相關文章:
1. 視頻文件不能播放,怎么辦?2. mysql - 把一個表中的數據count更新到另一個表里?3. 請教使用PDO連接MSSQL數據庫插入是亂碼問題?4. mysql 查詢身份證號字段值有效的數據5. visual-studio - Python OpenCV: 奇怪的自動補全問題6. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處7. node.js - nodejs開發中常用的連接mysql的庫8. python bottle跑起來以后,定時執行的任務為什么每次都重復(多)執行一次?9. python - 爬蟲模擬登錄后,爬取csdn后臺文章列表遇到的問題10. Python爬蟲如何爬取span和span中間的內容并分別存入字典里?
