更新与限制1 codeigniter使用活动记录 [英] Update with limit 1 in codeigniter use active record

查看:90
本文介绍了更新与限制1 codeigniter使用活动记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更新与codeigniter活动记录单记录,它仍然失败。

I'm trying to update a single record with the active record of codeigniter and it still fails.

$data = array('status' => 1);

$this->db->where('field1', $info);
$this->db->update('example', $data);
$this->db->limit(1);

当我运行更新数据库的所有领域。 通过使$这个 - > DB-> last_query()不显示我的极限

When i run updates all fields of the database. By making a $ this->db->last_query() does not show me the limit

什么是错误

推荐答案

更​​新应始终调用之前最后将限:

Move the limit before the update which should be always called last:

$this->db->limit(1);
$this->db->update('example', $data);

这篇关于更新与限制1 codeigniter使用活动记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆