codeigniters where and or where
I am trying to use
if($cat_id){
$this->db->where("q.question_cat_id",$cat_id);
if($sub){
$this->db->where_or("q.question_sub_id",$cat_id);
}
}
But geting error..
Answer (1)
You can modify just the two lines:
$this->db->where('q.question_cat_id',$cat_id);
$this->db->or_where('q.question_sub_id',$cat_id);
replace where_or with or_where