Reputation: 89
I need an assistance updating the session of my website. After running:
echo "<pre>";
print_r($this->session->all_userdata());
echo "</pre>";
It give me this result:
Array
([__ci_last_regenerate] => 1537865901
[logged_in] => 1
[user] => stdClass Object
([id] => 19755
[student_id] => test12345
[email] => [email protected]
[status] => 1
[date_created] => 2018-09-20
)
Basically what I need is to update the 'status' which is under the array 'user'. I tried:
$this->session->set_userdata('status', 0);
$this->session->set_userdata(user('status'), 0);
Any suggestion? Im using the latest codeigniter. Thanks
Upvotes: 1
Views: 52
Reputation: 89
Another thing that I found about the issue I'm having is that my codeigniter is outdated and not compatible with PHP 7.2 version. So another step is to get the latest patch from codeigniter. Thanks
Upvotes: 0
Reputation: 4142
get session object in variable and update object property and set again into session
$detailsData = $this->session->userdata('user');
$detailsData->status=0;
$this->session->set_userdata('user', $detailsData);
Upvotes: 1