Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 array the null key is not passed
#1

I installed the version of Codeigniter 4 and PHP 7.4.


Code:
composer
"name": "codeigniter4/appstarter"
"require": "codeigniter4/framework": "^4"


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);
$results $query->getResultArray();
return 
$results


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!
Reply


Messages In This Thread
Codeigniter 4 array the null key is not passed - by gra - 06-22-2020, 01:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB