简体   繁体   中英

How to use WHERE CLAUSE in Codeigniter 4

Hello i have 2 tables Student & Faculty i want to call them to my index(view), So I figured how to join them. but I have a problem, I need to divide these 2 tables into a category but I don't know the code. Can someone please help me?

 public function getStudentReguler()
{
    return $this->db->table('student')
        ->join('faculty', 'faculty.id_faculty = student.id_student')
        ->where('category', *i want to be like, where categor = A*)
        ->get()->getResultArray();
}

thank you

public function getStudentReguler()
{
    return $this->db->table('student')
        ->join('faculty', 'faculty.id_faculty = student.id_student')
        ->where('category', 'A')
        ->get()->getResultArray();
}

Please try this:

$this->db->select('*')
->from('student')
->join('faculty', 'faculty.id_faculty = student.id_student')
->where('category', 'A')
->get()->getResultArray();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM