0

登录(id,姓名,角色,user_id)老师(teacher_id)

我需要检查角色是 2。

$this->db->select('*');     
$this->db->from('teacher');     
$this->db->where('teacher_branch_id',$this->session->userdata('branch_id'));
$this->db->join('login','teacher.teacher_id = login.login_user_id');

$query = $this->db->get();
4

1 回答 1

2

只需添加这样的 where 条件:$this->db->where('login.role', 2);

$this->db->select('*');     
$this->db->from('teacher');     
$this->db->join('login', 'teacher.teacher_id = login.login_user_id');
$this->db->where('teacher_branch_id', $this->session->userdata('branch_id'));
$this->db->where('login.role', 2);

$query = $this->db->get();
于 2012-12-14T15:10:11.520 回答