📜  codeigniter 3 更新 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:54.148000             🧑  作者: Mango

代码示例4
$table = "my_table";
$id = 1;
$update = ["status"=>"working"];
//Edit just above /\ if you don't need extra "where" clause
$query = $this->db->select()
            ->from($table)
            ->where('id', $id)
            ->get_compiled_select();
$data = $this->db->query("$query FOR UPDATE")->row_array();
$this->db->where('id', $data['id'])->update($table,$update);