Hello all,
I am making use of seralize and unseralize to set and get session variables from my Database.
A user is in a session and every time they click save. I do this:
$array = serialize($_SESSION);
//and save to DB field
When a user loads a session, I load the variables too to continue that session like so:
//get row from DB
$_SESSION = unserialize($row['session_variables']);
This doesn't work for me. It firstly doesn't unseralize as it returns something like this when I
print_r($_SESSION)
:Array ( [user_id] => test2 [date_created] => [date_updated] => [session_variables] => a:9:{s:7:"user_id";s:5:"test2";s:12:"date_created";N;s:12:"date_updated";N;s:17:"session_variables";s:149:"a:6:{s:7:"user_id";s:5:"test2";s:4:"here";s:2:"12";s:5:"here2";s:6:"112432";s:5:"here3";s:6:"132432";s:5:"here4";s:4:"1qw2";s:5:"here5";s:5:"1wqe2";}";s:4:"here";s:2:"12";s:5:"here2";s:6:"112432";s:5:"here3";s:6:"132432";s:5:"here4";s:4:"1qw2";s:5:"here5";s:5:"1wqe2";} [here] => 12 [here2] => 112432 [here3] => 132432 [here4] => 1qw2 [here5] => 1wqe2 )
Where is the session_id for these variables to be used across different pages? Have I over written them?
Thanks all for any help
EDIT
Is the session_id kept in the global $_SESSION? I am guessing no. If I unset $_SESSION, it means the session will not be gone just the variables, correct? Anyone verify please?