开发者

A problem with pagination codeigniter (page 2 not showing)

im getting stuck when i show data from开发者_开发知识库 database with pagination codeigniter, the first page is show correctly, but when i click page 2, the number of page is selected but its still show the data of page 1, so do with next page. Here is my code

$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);

Anyone help me please Thanks in advance!


Check in your model how are you getting the page data. You must set the page you are looking for in that function, like in

    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();
}

it sounds like you are missing the 'from' param or something like that

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜