用户
 找回密码
 入住 CI 中国社区
搜索
查看: 24899|回复: 4
收起左侧

[HELP] CI框架 update 类的 使用问题

[复制链接]
发表于 2013-5-27 09:41:34 | 显示全部楼层 |阅读模式
如题

$where = "id_threads = ".$this->input->post('id_threads');
$data = array(
        'f_important' => $this->input->post('f_important')
);
$this->db->update('Top.memo_grp', $data, $where);
$chk = $this->db->affected_rows();
                       
$data = array(
        'memo' => $this->input->post('memo')
);
$this->db->update('Top.memo_posts', $data, $where);
$chk += $this->db->affected_rows();

用 WHERE 判断 要更新的 数据的时候 应该 怎么写?$this->db->update 我感觉这句写错了~
发表于 2013-5-27 11:52:55 | 显示全部楼层

$where 也需要是一个array。
这样试试。
$this->db->update('Top.memo_grp', $data, array("id_threads" => $this->input->post('id_threads')));
 楼主| 发表于 2013-5-27 15:03:37 | 显示全部楼层
经天纬地大魔王 发表于 2013-5-27 11:52
$where 也需要是一个array。
这样试试。
$this->db->update('Top.memo_grp', $data, array("id_threads"  ...

呵呵 你这样写 也对的 我原来的代码 语法也对 是我写错 表名 所以 出的错误~

但是还是谢谢你哈~
发表于 2013-5-27 15:20:18 | 显示全部楼层
L.e.e. 发表于 2013-5-27 15:03
呵呵 你这样写 也对的 我原来的代码 语法也对 是我写错 表名 所以 出的错误~

但是还是谢谢你哈~ ...

咦。。这样嘛。。哈哈哈。。那看来我看得还不仔细丫。。哈哈哈。。
发表于 2013-5-27 15:40:56 | 显示全部楼层
顶一个

本版积分规则