我有兩個表,其中用戶是admin,其信息存儲在用戶表中,學生信息存儲在用戶以及學生表中,所以當學生更新其基於id字段的學生表表如何更新用戶表在codeigniter中同時更新兩個表
users
id | email |password |firstname |user_type
1 [email protected] dfdf a 0 //(user)
2 [email protected] dgg g 1//(student)
3 [email protected] fjh dd 1//(student)
students
id | email |firstname |lastname| user_id
2 [email protected] dgg g 2
3 [email protected] fgh dd 3
與此更新查詢
function update($student_id,$data)
{
$this->db->where(array('id' => $student_id));
return $this->db->update('students',$data);
}