Question : codeigniter update or create
Answered by : tiago-frana
$this->db->where('user_id',$id); $q = $this->db->get('profile'); if ( $q->num_rows() > 0 ) { $this->db->where('user_id',$id); $this->db->update('profile',$data); } else { $this->db->set('user_id', $id); $this->db->insert('profile',$data); }
Source : https://stackoverflow.com/questions/35223752/codeigniter-insert-if-not-exist-and-update-if-not/35223951 | Last Update : Wed, 15 Sep 21
Question : update codeigniter
Answered by : eula-mae-barcelona
$this->db->set('fieldname', 'value');
$this->db->where('id', 2);
$this->db->update('tablename');
Source : | Last Update : Thu, 21 Oct 21