我正在使用codeigniter 2.1.3,我遇到了极限问题

时间:2013-02-21 15:42:37

标签: codeigniter

我使用的是codeigniter 2.1.3,我遇到了限制

的问题

这是我的控制者:

$config['base_url'] = site_url("agreement/listar_my_agreements/");        
                                                                             /*project uid*/
    $config['total_rows'] = count($this->agreement_model->find_by_projectuid($this->uri->segment(3)));
$config['uri_segment'] = 3;
    $config['per_page'] = 4;

    print_r($config['total_rows']);

    $this->pagination->initialize($config);
   // $Ddata['agreements']=$this->agreement_model->get_all_posts($config['per_page'],$this->uri->segment(3,0),$this->uri->segment(3));
    $Ddata['agreements']=$this->agreement_model->listar_myagreement($config['per_page'],$this->uri->segment(3,0),$this->uri->segment(3));

   print_r($Ddata['agreements']);
$Ddata['pagination'] = $this->pagination->create_links();
    /* carregar o template */       
    $this->template->write_view('meta', 'html/meta',  $Dmeta, true);   
    $this->template->write_view('header', 'html/header', $Dheader, true);     
    $this->template->write_view('content', 'onplans/list_my_agreements', $Ddata, true);
    $this->template->write_view('sidebar', 'html/sidebar_user');
    $this->template->write_view('footer', 'html/footer');

    $this->template->render();

这是我的模特:

    function listar_myagreement($limit,$offset,$project_uid){

    print_r('find architect limit'.$limit);
    print_r('find architect offset'.$offset);
    print_r('find architect project_uid'.$project_uid);



$this->db->from('agreement');

$this->db->where('projectUID',$project_uid);
    $this->db->limit($limit, $offset);
    $query = $this->db->get();

    if ($query->num_rows() > 0) {
        foreach ($query->result_array() as $row) {
            $result[] = $row;
        }
    } else {
        $result = false;
    }


    return $result;



}

这是计数代码:

  function find_by_projectuid($project_uid) {



    //$this->db->order_by('project.dateCreation', 'DESC');

$this->db->from('agreement');
$this->db->where('projectUID',$project_uid);

    $query = $this->db->get();

    if ($query->num_rows() > 0) {
        foreach ($query->result_array() as $row) {
            $result[] = $row;
        }
    } else {
        $result = false;
    }


    return $result;

}

问题是我有6条记录,它有6条记录,但有限制只能找到3条记录

感谢 佩德罗

0 个答案:

没有答案