|
models: getdataM
function getdateCondition($per_page,$start,$cond){
$this->db->select("A.*,B.typename");
$this->db->from("A");
$this->db->join('B','B.f_id=B.typeid'); // $this->db->join的使用。
$this->db->where($cond);
$this->db->orderby('createtime','desc');
$this->db->limit($per_page,$start);
$rs=$this->db->get();
$res=$rs->result();
return $res;
}
controls:
function index($start=0){
$conf['per_page']=50;
$conf['total_rows']=$this->getdataM->totalRecordsByCondition("where status='1'");
$conf['base_url']=site_url()."/index/";
$conf['uri_segment']=3;
$this->load->library('pagination',$conf);
$temp['links']=$this->pagination->create_links();
$res=$this->getdataM->getdataCondition($conf['per_page'],$start,array('status'=>'1'));
$temp['res']=$res;
$temp['per_page']=$conf['per_page'];
$this->load->view('indexview',$temp);
}
views:
<?=$res->f_typename;?> //取不到值,??????????????为何? |
|