[eluser]Gijs Bloemen[/eluser]
Hi all,
I am trying to use sessions in codeigniter and when I have putted something in a session and I called it with the $this->session->user_data(..) it gives this error: Fatal error: Call to undefined method CI_Session::user_data()
Below I putted my code, but I stripped everything away that has to do nothing with the sessions:
Code:
//Load the session library
$this->load->library('session');
//Define variable username and variable rand
$username = $this->form_validation->set_rules('username' ,'trim');
$rand = rand(0,999999);
//Putting this in an array
$session_data = array (
'username' => $username,
'u_id' => $rand,
);
//Put the array in a session
$this->session->set_userdata($session_data);
//Get the information out of the session (this part of the code is putted in an other //controller, ofcourse I also loaded in this controller the session library)
$data = array (
'session_username' => $this->session->user_data('username'),
'session_rand' => $this->session->user_data('rand'),
'title' => 'Hoofdkwartier',
);
I got the error on the line where is placed 'session_username'=> $this->session->user_data('username'),
Regards,
Gijs Bloemen
(Sorry for my bad English)