Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 分页代码点火器存在问题(第2页未显示)_Php_Codeigniter_Pagination - Fatal编程技术网

Php 分页代码点火器存在问题(第2页未显示)

Php 分页代码点火器存在问题(第2页未显示),php,codeigniter,pagination,Php,Codeigniter,Pagination,当我用pagination codeigniter显示数据库中的数据时,我被卡住了,第一页显示正确,但当我单击第2页时,页面数被选中,但它仍然显示第1页的数据,下一页也是如此。这是我的密码 $id = $this->uri->segment(3); $perpage = 5; $this->load->library('pagination'); $config['base_url'] = base_url().'index.php/contname/method/'.$

当我用pagination 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);
谁能帮帮我
提前谢谢

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

    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();
}
函数getPage($count=5,$from=0){//参数很重要
$this->db->select('*',FALSE);
..........

$query=$this->db->get('your_table',$count,$from);//检查您的模型如何获取页面数据。您必须在该函数中设置要查找的页面,如

    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();
}
函数getPage($count=5,$from=0){//参数很重要
$this->db->select('*',FALSE);
..........

$query=$this->db->get('your_table',$count,$from);//看起来不错。我们还需要查看您的数据库查询。这是关于uri段的,我已经修复了,谢谢!我们还需要查看您的数据库查询。这是关于uri段的,我已经修复了,谢谢!我已经在控制器中添加了它:$offset=$this->uri->段(4)。谢谢!太好了!我怀疑偏移量问题在模型中,而不是在控制器中。对不起,我很久没有打开stackoverflow了,现在我已经接受了答案,谢谢:)我已经在控制器中添加了此项:$offset=$this->uri->segment(4)。谢谢!太好了!我怀疑偏移问题在模型中,而不是控制器中。对不起,我很久没有打开stackoverflow了,现在我接受了答案,谢谢:)