Codigniter 活动记录更新查询采用旧的 where 子句
我有一个以下查询
$this->db->set('registerStep', $param)
->where('id = ',$user_id)
->update($this->table_name);
上面的查询正在生成下面的 sql 代码。即使我只提供一个条件。
UPDATE `users` SET `registerStep` = 2 WHERE `id` = 33 AND `id` = '165'
我认为活动记录正在使用一些缓存的 where 条件,有什么方法可以释放 where 条件。
我尝试使用
$this->db->flush_cache();
但这没有帮助。
I have a following query
$this->db->set('registerStep', $param)
->where('id = ',$user_id)
->update($this->table_name);
Above Query is producing below sql code. even though I'm supplying only one where condition.
UPDATE `users` SET `registerStep` = 2 WHERE `id` = 33 AND `id` = '165'
I think active record is using some cached where condition, is there any way I can free where condition.
I tried using
$this->db->flush_cache();
But it's not helping.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://codeigniter.com/user_guide/database/active_record.html#update
是不正确的。
是正确的。
http://codeigniter.com/user_guide/database/active_record.html#update
is incorrect.
is correct.
您的查询完全正确。但我相信您在当前查询之前使用了 $this->db->where() 。使用以下代码,您将看到所有先前定义的“where”语句:
Your query is fully correct. But I believe what you used a $this->db->where() before current query. Use the following code and you will see all the previously defined "where" statements: