php - Get Updated Record in Session -


i'm trying store latest record updated in user profile using session, record updating in database unable latest record value in session, session showing old value.

here code of controller class

// update student information     public function model_studentupdate() {         $studentid          = $this->db->escape($this->session->userdata('student_id'));         $studentname        = $this->db->escape($this->input->post("name"));         $studentcontact     = $this->db->escape($this->input->post("contact"));         $studentcity        = $this->db->escape($this->input->post("city"));         $studentcountry     = $this->db->escape($this->input->post("country"));          // update record in user table         $this->db->query("update `ot4u_users` set         `user_name`=$studentname,         `user_phone`=$studentcontact,         `user_country`=$studentcountry,         `user_city`=$studentcity         `user_id` = $studentid");          // records of student         $query  = $this->db->query("select * `ot4u_users` ot4u_users.user_id = $studentid");         $query  = $query ->result();              // store latest data of tutor in session             $tutorsessiondata = array(             'student_id'        => $query[0]->user_id,             'student_name'      => $query[0]->user_name,             'student_phone'     => $query[0]->user_phone,             'student_city'      => $query[0]->user_city,             'student_country'   => $query[0]->user_country,             'is_logged_in'      => true             );             $this->session->set_userdata($studentsessiondata);             return true;     } 

is there i'm missing in code? please

you have 2 different variables there:

$tutorsessiondata = array(         //etc         );         $this->session->set_userdata($studentsessiondata); 

should be

$studentsessiondata = array(         //etc     );  $this->session->set_userdata($studentsessiondata); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -