hi i would like to ask if it is possible to update the session data saved in the database in codeigniter,, for example. i have a session userdata(roleID,name,logged_in), so that when someone will login, ill just call the $data['name'] = $this->session->userdata('name');
and echo it in my header view as <?php echo $name; ?>
,, the problem is when a user will update his firstname or lastname, and when i do this
$fname = $this->input->post('fname');
$lname = $this->input->post('lname');
$fullname = $fname." ".$lname;
$this->session->unset_userdata('name');
$this->session->set_userdata('name',$fullname);
it doesnt work..
//EDIT WORKING RIGHT NOW... JUST TYPO AND SYNTAX ERRROR
If you want to update the session data, use:
$this->session->set_userdata('name', $fullname);
There is no need to use unset_userdata
More info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With