我的控制器
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条记录进行显示。简而言之,分页不起作用。帮助
答案 0 :(得分:0)
更好用:
$this->db->limit($num,$offset);
$query = $this->db->get('home');
return $query->row_array();