I need to add an item array in a exist array. When i try to add i get something like this, using array_push
Array
(
[0] => Array
(
[totalp] => 3.26
[mes] => Novembro
)
[1] => Array
(
[totalp] => 2.66
[mes] => Dezembro
)
[2] => Array
(
[0] => Array
(
[bonus] => 2.6
)
[1] => Array
(
[bonus] => 4.16
)
)
)
but i need this.
Array (
[0] => Array
(
[totalp] => 3.26
[mes] => Novembro
[bonus] => 2.6
)
[1] => Array
(
[totalp] => 2.66
[mes] => Dezembro
[bonus] => 4.16
) )
follow my code.
$arrRows = array();
while ($dados = $resultp ->fetch_array(MYSQLI_ASSOC)) {
$arrRows[] = $dados;//getting totalp and mes here
}
$arrRows1 = array();
while ($dados = $resultb ->fetch_array(MYSQLI_ASSOC)) {
$arrRows1[]=$dados; //getting bonus here
}
array_push($arrRows,$arrRows1); // first example, but i dont need this way.
print_r($arrRows);
thankyou