[英]like and where in codeigniter active record query
我有一段代碼,應該返回屬於特定學校的學生詳細信息,我正在粘貼代碼
function return_student($query,$student_school){
$this->db->select('student_name,student_subject,student_age,student_id');
$this->db->from('students');
$this->db->like('student_name',$query);
$this->db->or_like('student_subject',$query);
$this->db->where('student_school',$student_school);
$query = $this->db->get();
}
現在這段代碼正在返回所有數據,但不檢查該學生是否屬於該特定學校,我不知道我在做什么錯!
我知道了,
$this->db->having('student_school',$student_school);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.