1
我有這個功能模型笨模型功能和/或查詢
function select($table,$match,$or){
$this->db->select('*');
$this->db->from($table);
$this->db->where($match)->or_where($or);
$query = $this->db->get();
$query_result = $query->result();
return $query_result;
}
和控制器
$post = array("class"=>"XI","section"=>"A","stream"=>"Medical");
$data = $this->main_model->select("class_subjects",array("class"=>$post['class'],"section"=>"all","stream"=>$post['stream']),$post);
print_r($data);
我沒有得到任何錯誤,但這個是打印表的全部數據。我怎麼能比得上class='XI' and stream='Medical' and (section='A' or section='all')
它爲我工作,感謝您的幫助。 –