Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 model insert bug with decimals
#1

Greetings,
Just wanted to report that i was trying to insert a value of 0.18(float) into a DECIMAL field in phpmyadmin with lenght 4,2.
At start i was thinking the problem were the field settings, but i found after that the problem was the insert of the codeigniter 4 premodel that did an automatic rounding of the decimal to 0.00.
Then i've created my own insert function using query builder instead and the value 0.18 was correctly inserted in the db.

MODEL FUNCTION:
PHP Code:
public function inserisci($data = array())
    {
        $builder $this->db->table('dati_commesse');
        return $builder->insert($data);
    

hope this will help someone that will face the same issue
Reply




Theme © iAndrew 2016 - Forum software by © MyBB