I make a select
in the database which returns me a array
of data. With this, I make the following foreach
on it:
foreach ($resultado4 as $key => $value7) {
$array6[$value7['carteira'].'flores'] = $value7['floresqtd'];
$array6[$value7['carteira'].'isa'] = $value7['isaqtd'];
$array6[$value7['carteira'].'uni'] = $value7['uniqtd'];
$array8[$value7['carteira'].'flores'] = $value7['floresvalor'];
$array8[$value7['carteira'].'isa'] = $value7['isavalor'];
$array8[$value7['carteira'].'uni'] = $value7['univalor'];
}
Sometimes, one of the indexes of the select come with no result, in the case of the index Z, does not exist. When this happened, I wanted to put the value of this nonexistent index as 0, thus creating it and assigning the value 0, since I need it to perform some accounts that do not enter into the question. So far I have not been able to formulate any logic to accomplish the same thing.