CI框架数据库构造器or_where

public function index(){
	    
	    //查询优惠券
	    $weishiyong = $this->db->select('*')->get_where("imt_member_couponslog",array('uid'=>$this->uid,'status'=>1))->result_array();
	    $yishiyong = $this->db->select('*')->get_where("imt_member_couponslog",array('uid'=>$this->uid,'status'=>0))->result_array();
	    $yiguoqi = $this->db->where('uid',$this->uid)->or_where('start_time>',time())->or_where('end_time<',time())->get('imt_member_couponslog')->result_array();
	    
	    $this->template->assign(array(
            'weishiyong' => $weishiyong,
            'yishiyong' => $yishiyong,
            'yiguoqi' => $yiguoqi,
        ));
	    $this->template->display('coupons_index.html');
	}
"SELECT * FROM `imt_member_couponslog` WHERE `uid` = 5 OR `start_time` > 1548314715 OR `end_time` < 1548314715"

 

No comments, so go and ...add one

Speak Your Mind

Your email address will not be published. Required fiels are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>