CodeIgniter Forums
CI session and session ID - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: CI session and session ID (/thread-28229.html)

CI session and session ID - El Forum - 03-05-2010


I have a cart database table with session column which represent the CI session_id.

My question is - is there any way how to recognize that the session_id changed?

Debug session action:
FROM (`tc_ci_sessions`)
WHERE `session_id` = '99c86bd7597f7e463750ab94dbadb9dc'
AND `user_agent` = 'Opera/9.80 (Windows NT 6.1; U; cs) Presto/2.5.22 V'  

UPDATE `tc_ci_sessions` SET `last_activity` = 1267785550, `session_id` = 'd99c65b60773945ee125bd112e84903a' WHERE session_id = '99c86bd7597f7e463750ab94dbadb9dc'

Without changing the session ID in a cart I loose him and I dont want that before 7200 seconds.

CI session and session ID - El Forum - 03-05-2010

I did a little research in code and I think the best solution is add an extra db query in the Session library.

$this->CI->db->query($this->CI->db->update_string($this->sess_table_name, array('last_activity' => $this->now, 'session_id' => $new_sessid), array('session_id' => $old_sessid)));

$this->CI->db->query($this->CI->db->update_string('my_table', array('session_id' => $new_sessid), array('session_id' => $old_sessid)));

Hope that helps anyone else with similar problems.

Another suggestions are welcomed.