CodeIgniter Forums
Setting a session by id - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Setting a session by id (/showthread.php?tid=67457)



Setting a session by id - bjacobs - 02-24-2017

I'm using a very old version of CI (2.0.2) and I'm having a problem where if I have multiple sessions in the ci_sessions table, on a redirect back to my site, it's grabbing the first session it sees instead of the one it left the site with. 

I have decided to store the appropriate session ID in my db. But now when you redirect back to my site, I want to set the current session to be the one I had stored the ID for.

I see lots of things on setting the session_id, but how to I actually set the current session based on a session ID?

Ex: I can see two session records in the ci_sessions table. Say one with session_id="a" and one with session_id="b". I'm currently working in "a". When I redirect and come back, it is now on session "b" or creates "c". I want to set it back to "a", which I can see still exists in the ci_sessions table.