Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

session update in codeigniter

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

like image 754
kester martinez Avatar asked May 26 '11 03:05

kester martinez


1 Answers

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

like image 151
Pav Avatar answered Oct 13 '22 13:10

Pav