Welcome Guest, Not a member yet? Register   Sign In
CI session class, cant handle objects?
#1

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




Theme © iAndrew 2016 - Forum software by © MyBB