CodeIgniter Forums

Full Version: Session unset_userdata unsetting all user_data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]RS71[/eluser]
I've been trying to delete certain items from the session but regardless of what I pass unset_userdata(), it deletes all user_data in the DB.

I've tried:

Code:
$data = array(
    'user_id' => '',
    'user_token' => ''
);

$this->CI->session->unset_userdata($data);

and

Code:
$this->CI->session->unset_userdata('user_id');
$this->CI->session->unset_userdata('user_token');

Did I do something wrong?

El Forum

[eluser]xpacio[/eluser]
hello y use session in this way.

Code:
public function logout ( )
    {
        $this->session->unset_userdata('nick');
        $this->session->set_userdata('acl',0);
        redirect('session/login');
    }