update with where clause 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: update query in codeigniter using where condition
public function update_row(){
$update_rows = array('field-name' => 'field-data',);
$this->db->where('id', 1 );
$this->db->update('table-name', $update_rows);
}