我的控制器
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 条记录。简而言之,分页不起作用。帮助