![]() |
Codeigniter 4 array the null key is not passed - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Codeigniter 4 array the null key is not passed (/showthread.php?tid=76808) |
Codeigniter 4 array the null key is not passed - gra - 06-22-2020 I installed the version of Codeigniter 4 and PHP 7.4. Code: composer I have a problem when returning an array after a query from a model, I don't get null values. My controller PHP Code: $data["data1"] = $this->model->MO_model->Myget($id); My model: MO_model PHP Code: $query = $this->db->query($query_DB); It happens that $results has all the values of the query. Ex: in model first the return command PHP Code: $results = one => "1",two => Null When I read the array from the controller immediately after the call to the model. PHP Code: Ex. $data["data1"] = one => "1" The null key is not passed. I don't know if it's a return behavior of PHP or Codeigniter. I'm not very experienced and I don't know if it's a Codeigniter or PHP settings problem. Thanks! RE: Codeigniter 4 array the null key is not passed - inumaru - 06-23-2020 I tried your code and it is working just fine, the null value got displayed in my controller as in my model. my php version is still 7.3.1 but I just install CI 4 so it is the latest 4.0.3 Did your code just that or did you use some library or anything else? Code: \app\Models\UserAuth.php:23: RE: Codeigniter 4 array the null key is not passed - gra - 06-23-2020 Quote:it is as I have shown. |