保定网站建设,网站推广,网站优化服务,保定专业的PHP网站制作机构!

解决CakePHP OthAuth组件更新用户登录时间(last_visit)的错误

发表于:2008年10月27日 15时  作者:dx_andy

错误描述

Query: INSERT INTO `users` (`last_visit`,`created`,`modified`) VALUES (‘2008-10-27 07:50:17′,’2008-10-27 07:50:17′,’2008-10-27 07:50:17′)
Warning: SQL Error: 1062: Duplicate entry ” for key 2 in D:\www\hosts\cake\ucake-libs\cake\libs\model\datasources\dbo_source.php on line 439

此错误出现的原因是:用户登录成功后更新最后登录时间时($this->controller->{$this->user_model}->save($row,true,array($this->user_table_last_visit));)丢失其要修改记录的ID造成。

解决办法:在此行(大概在134行)前面添加下面代码

PHP代码

$this->controller->{$this->user_model}->id = $this->user(‘id’);

 订阅“PHPLAMP博客”方便及时获取网站内容

PHPLAMP博客是专注于网站建设,搜索引擎研究,网站推广,网站优化的IT博客。

有关, , 的相关文章:

发表一下您对本文的意见