L.e.e. 发表于 2013-5-27 09:41:34

CI框架 update 类的 使用问题

如题

$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')));

L.e.e. 发表于 2013-5-27 15:03:37

经天纬地大魔王 发表于 2013-5-27 11:52 static/image/common/back.gif
$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 static/image/common/back.gif
呵呵 你这样写 也对的 我原来的代码 语法也对 是我写错 表名 所以 出的错误~

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

咦。。这样嘛。。哈哈哈。。那看来我看得还不仔细丫。。哈哈哈。。

gfwxy 发表于 2013-5-27 15:40:56

顶一个
页: [1]
查看完整版本: CI框架 update 类的 使用问题