I have found a way of doing it but i need to query db on each update and this add some execution time.
Any other way to store the content of Date_Deb in a variable before evaluating it ?
function update_date_debriefe($post_array,$primary_key) { $this->db->select('*') ->from('t3') ->where('ID', $primary_key); $db = $this->db->get(); $row = $db->row(0); $DD = $row->Date_Deb; if((empty($DD)) && ($post_array['Etat'] == '3')) { $date_debriefe = array("ID" => $primary_key,"Date_Deb" => date('2017-01-10')); $this->db->update('t3',$date_debriefe,array('ID' => $primary_key)); return $post_array; } }