1$data = [
2 'title' => $title,
3 'name' => $name,
4 'date' => $date
5];
6
7$builder->where('id', $id);
8$builder->update($data);
9// Produces:
10//
11// UPDATE mytable
12// SET title = '{$title}', name = '{$name}', date = '{$date}'
13// WHERE id = $id
14
1 $this->db->where('user_id',$id);
2 $q = $this->db->get('profile');
3
4 if ( $q->num_rows() > 0 )
5 {
6 $this->db->where('user_id',$id);
7 $this->db->update('profile',$data);
8 } else {
9 $this->db->set('user_id', $id);
10 $this->db->insert('profile',$data);
11 }
12