// Run the update query $this->CI->db->where('session_id',$this->userdata['session_id']); $this->CI->db->update($this->sess_table_name,array('last_activity' => $this->userdata['last_activity'],'user_data' => $custom_userdata));
我在CodeIgniter中使用会话时遇到问题.我下载了de las CI版本,我必须修改很多东西才能使它工作,但是,当我尝试登录我的网页时,我遇到了这个问题,有1064错误MysqL:
You have an error in your sql Syntax; check the manual that
corresponds to your MysqL server version for the right Syntax to use
near ‘SETlast_activity
= 1430854831,user_data
=
‘a:8:{s:9:\”user_data\”;s:0:\”\”‘ at line 1UPDATE SET
last_activity
= 1430854831,user_data
=
‘a:8:{s:9:\”user_data\”;s:0:\”\”;s:10:\”id_cliente\”;s:1:\”2\”;s:4:\”name\”;s:14:\”Martín
Sosa\”;s:8:\”lastName\”;s:6:\”Plaz\”;s:9:\”lastName2\”;s:4:\”Loah\”;s:15:\”numberExpedient\”;s:5:\”00002\”;s:5:\”email\”;s:27:\”mart94@hotmail.com\”;s:3:\”rol\”;s:1:\”1\”;}’
WHEREsession_id
= ‘6b4cceb3679bdc63a4534c6be0efd54f’Filename: libraries/Session.PHP
Line Number: 289
解决方法
update TABLE_NAME set ...
是否正确设置了$this-> sess_table_name?
检查您的配置文件:
$config['sess_table_name'] = 'ci_sessions';
另外,查看手册:
http://www.codeigniter.com/userguide3/libraries/sessions.html