2012-04-13 12 views
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つのレコードを指定している間に表示されます。要するに、ページネーションは機能しません。より良い

+0

任意の提案やアドバイス、それが急務であるください – asifa

+0

私はあなたのクエリ –

+0

機能get_pageにオフセットし、制限句を使用していないかなり確信しているモデルのコードを投稿してください( $ num、$ offset) { \t $ query = $ this-> db-> get( 'home'、$ num、$ offset); \t return $ query; } – asifa

答えて

0

その使用するヘルプ:

$this->db->limit($num,$offset); 
$query = $this->db->get('home'); 
return $query->row_array(); 
関連する問題