update where codeigniter 4 code example
Example 1: codeigniter update
$data = [
'title' => $title,
'name' => $name,
'date' => $date
];
$builder->where('id', $id);
$builder->update($data);
// Produces:
//
// UPDATE mytable
// SET title = '{$title}', name = '{$name}', date = '{$date}'
// WHERE id = $id
Example 2: codeigniter 3 update
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->where('id', $id);
$this->db->update('mytable', $data);