我有一個應用程序在數據庫中搜索活動作業,並將它們返回到結果列表中。該部分工作正常,但分頁不起作用。當我點擊鏈接轉到下一個10個工作時,它只停留在同一頁面上。爲什麼我的分頁結果不起作用?
這裏是代碼的樣子。
$currPage = (($s/$limit) + 1);
// Links to access additional results
if ($s>=1) {
$prevs=($s-$limit);
$upd_msg_prev = '<a href="'.$here.'?state='.$state.$cid_searched.'&s='.$prevs.'"><< Prev 10</a> | ';
if ($s>$numrows-10) {
$upd_msg_next = 'Next 10 >>';
}
} else {
if ($numrows>10) {
$upd_msg_prev = '<< Prev 10 | ';
}
}
$here = isset($_POST['here']);
// calculate number of pages needing links
$pages=intval($numrows/$limit);
// Check how many $pages are needed by getting total plus one if there's a remainder
if ($numrows%$limit) {
$pages++;
}
// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
$news=($s+$limit);
$upd_msg_next = '<a href="'.$here.'?state='.$state.$cid_searched.'&s='.$news.'">Next 10 >></a>';`
}
最後兩行代碼中存在一個錯誤。 – HeroFTime