簡體   English   中英

分頁代碼點火器出現問題(第2頁未顯示)

[英]A problem with pagination codeigniter (page 2 not showing)

當我使用分頁代碼點火器顯示來自數據庫的數據時,即時通訊卡住了,正確顯示了第一頁,但是當我單擊第2頁時,選擇了頁數,但仍顯示第1頁的數據,因此對下一頁也是如此。 這是我的代碼

$id = $this->uri->segment(3);
$perpage = 5;
$this->load->library('pagination');
$config['base_url'] = base_url().'index.php/contname/method/'.$id;
$config['total_rows'] = $this->feedbackmodel->count_itemscat($id);
$config['per_page'] = $perpage;
$config['uri_segment'] = 4;
$this->pagination->initialize($config);

任何人都可以幫助我,謝謝!

檢查您的模型如何獲取頁面數據。 您必須在該功能中設置要查找的頁面,例如

    function getPage($count = 5, $from = 0) { // params are important
    $this->db->select('*', FALSE);

    ..........

    $query = $this->db->get('your_table', $count, $from); // <- that's important: $count, $from

    return $query->result();
}

聽起來您好像缺少了'from'參數或類似的東西

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM