分页 codeigniter 的问题(第 2 页未显示)

发布于 2024-11-05 22:07:23 字数 485 浏览 0 评论 0原文

当我使用分页 Codeigniter 显示数据库中的数据时,我遇到了困难,第一页显示正确,但是当我单击第 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);

请有人帮助我 提前致谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥抱影子 2024-11-12 22:07:23

检查您的模型如何获取页面数据。您必须在该函数中设置您要查找的页面,就像听起来

    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”参数或类似的东西

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文