0
I make a select
in the database from which I get a array
data. With this, I do the following foreach
in the same:
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, it happens that one of the select’s Dexes comes with no results, in the case of index Z, does not exist. When this happened, I wanted to put the values of this nonexistent index as 0, thus creating it and assigning the value 0, because I need it to perform some accounts that does not enter the question. So far I haven’t been able to formulate any logic to accomplish the same.