I have controller example name by test.
In index method I will make session, it will store in database successfully, but when I want to read them in other method, it will make another session in database.
For example:
public function index(){
$this->session->set_userdata('test','test');
}
public function test(){
echo $this->session->userdata('test');
}
It will echo nothing. And when I check the database, it made new row.
I’ve seen elsewhere (for example here) that Codeigniter has problems with cookies on localhost and that will cause the problems that you are describing because if the cookie is not valid Codeigniter won’t be able to recognize the session and collect that information from the database. In order to verify this hypothesis you can upload your application to a real server and try it there.