Currently, I am using Codeigniter 3.1.0. I am trying to insert data using $this->db->insert('table') in Model.
The problem is that when I try to insert a certain filed value as 0, it would not insert 0, instead, it inserts 10.
I have verified the value of the data and its type.
Any suggestion or advice would be appreciated. Thank you in advance.
$data['Vat'] = 0;
foreach ( $data as $key => $value ) {
if ( $value === null ) {
continue;
}
$this->db->set($key, $value);
}
// $this->db->set('Vat', 0);
$this->db->insert(self::TABLE);
$q = $this->db->affected_rows();
return $this->db->insert_id();