1

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

2 Answers 2

1

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);  
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.