如何在 Codeigniter 4 中使用 WHERE CLAUSE
How to use WHERE CLAUSE in Codeigniter 4
你好,我有 2 个表学生和教员
我想把他们叫到我的索引(视图),所以我想出了如何加入他们。但是我有一个问题,我需要将这2个表分成一个类别但我不知道代码。有人可以帮我吗?
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();
}
谢谢
public function getStudentReguler()
{
return $this->db->table('student')
->join('faculty', 'faculty.id_faculty = student.id_student')
->where('category', 'A')
->get()->getResultArray();
}
请试试这个:
$this->db->select('*')
->from('student')
->join('faculty', 'faculty.id_faculty = student.id_student')
->where('category', 'A')
->get()->getResultArray();
你好,我有 2 个表学生和教员 我想把他们叫到我的索引(视图),所以我想出了如何加入他们。但是我有一个问题,我需要将这2个表分成一个类别但我不知道代码。有人可以帮我吗?
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();
}
谢谢
public function getStudentReguler()
{
return $this->db->table('student')
->join('faculty', 'faculty.id_faculty = student.id_student')
->where('category', 'A')
->get()->getResultArray();
}
请试试这个:
$this->db->select('*')
->from('student')
->join('faculty', 'faculty.id_faculty = student.id_student')
->where('category', 'A')
->get()->getResultArray();