编码点火器中的分页未按预期工作


pagination in codeigniter not working as expected

My Controller

function index()
{
    $this->load->library('pagination');
    $this->load->model('specialoffer_model');
    if($this->input->post('btnUpdate'))
    {
        $this->specialoffer_model->addoffer();
    }
    $data['addoffer']=$this->specialoffer_model->addoffer();
    $data1=array(
                'row'=>$data['addoffer']['row'],
                'result'=>$data['addoffer']['result'],
                );
     $config['base_url'] = site_url('specialoffer/index') . '/';
     $config['total_rows'] = $this->db->count_all('home');
     $config['per_page'] =2;
     $this->pagination->initialize($config);
     $data1['results'] =
                    $this->specialoffer_model->get_page (
                                $config['per_page'],
                                $this->uri->segment(3));
     $this->load->view('specialoffer',$data1);
}

视图

 echo $this->pagination->create_links(); 

仅生成页面链接,单击它时刷新页面,但显示表中的所有记录,而我已经从表中指定了要显示的 2 条记录。简而言之,分页不起作用。帮助

最好使用:

$this->db->limit($num,$offset);
$query = $this->db->get('home');
return $query->row_array();