Codeigniter 4 array the null key is not passed |
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!
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: Quote:it is as I have shown. |
Welcome Guest, Not a member yet? Register Sign In |