CodeIgniter Forums
Session start is deleting my data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Session start is deleting my data (/thread-67664.html)



Session start is deleting my data - genesispro - 03-22-2017

in order to add an item to the session I am using
session()->start();
and then 
session()->set('foo', 'bar');
and the data is stored in the db


but when I what to read the session items when I do a 
session()->get();
it is empty but I can see the "foo" item in the database


the moment I do a 
session()->start();
all data gets overwritten

how can I read the session data without running the start() function that clears my old data?

and how do I store a new item in the session without using start() because then I loose again the session items!

Thank you in advance