我有两个表,其中用户是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);
}