0
我控制器分頁的笨工作不正常
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條記錄顯示。簡而言之,分頁不起作用。幫助
任何建議或意見,請迫切 – asifa 2012-04-13 06:24:07
請發表您的型號代碼,我敢肯定你沒有使用偏移量和限制條款在查詢 – 2012-04-13 07:46:44
功能get_page( $ num,$ offset) { \t $ query = $ this-> db-> get('home',$ num,$ offset); \t return $ query; } – asifa 2012-04-13 08:51:37