update in codeigniter => code example
Example 1: update in codeigniter query
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->where('id', $id);
$this->db->update('mytable', $data);
// Produces:
//
// UPDATE mytable
// SET title = '{$title}', name = '{$name}', date = '{$date}'
// WHERE id = $id
Example 2: 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