CodeIgniter Forums
CI session class, cant handle objects? - 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: CI session class, cant handle objects? (/thread-47600.html)



CI session class, cant handle objects? - El Forum - 12-14-2011

[eluser]Unknown[/eluser]
If i do this when i login, the session will only last until i flip to another page in my app.
Code:
$userObject = new User($data->id, $data->username, $data->password);  
$this->session->set_userdata('user', $userObject);

However if i just put a string into the session similar to this:
Code:
$this->session->set_userdata('user', "logged");

The session will stay with me throughout the page.
It's as if the first method which is the one i need doesn't stick in the session?

I have this is my index.php top:
Code:
require_once("application/misc/includes.php");
session_start();

The includes.php only has the User.php atm.