CodeIgniter Forums
Session unset_userdata unsetting all user_data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Session unset_userdata unsetting all user_data (/thread-43910.html)



Session unset_userdata unsetting all user_data - El Forum - 07-27-2011

[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?


Session unset_userdata unsetting all user_data - El Forum - 07-27-2011

[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');
    }