I have two arrays from a different database, now I have to print it's in a table as a combined report. those arrays are
array:3 [▼
0 => array:6 [▼
"count_id" => 5
"count_name" => "NE 28/1"
"order_qty" => 75100
"balance_qty" => 75100
"stock_qty" => "0"
"order_req" => 75100
]
1 => array:6 [▼
"count_id" => 13
"count_name" => "NE 20/1 KH"
"order_qty" => 2200
"balance_qty" => 2200
"stock_qty" => "48400"
"order_req" => 0.0
]
]
and the second array
array:2 [▼
0 => array:6 [▼
"count_id" => 13
"count_name" => "NE 20/1 KH"
"order_qty" => 2200
"balance_qty" => 2200
"stock_qty" => "45420.85"
"order_req" => 0.0
]
1 => array:6 [▼
"count_id" => 24
"count_name" => "NE 24/1 KH"
"order_qty" => 5150
"balance_qty" => 5150
"stock_qty" => "45420.85"
"order_req" => 0.0
]
]
Now I need the common "count_name" Like "NE 20/1 KH" value will sum and print only once. Something Like...
array:3 [▼
0 => array:6 [▼
"count_id" => 5
"count_name" => "NE 28/1"
"order_qty" => 75100
"balance_qty" => 75100
"stock_qty" => "0"
"order_req" => 75100
]
1 => array:6 [▼
"count_id" => 13
"count_name" => "NE 20/1 KH"
"order_qty" => 4400
"balance_qty" => 4400
"stock_qty" => "96800"
"order_req" => 0.0
]
2 => array:6 [▼
"count_id" => 24
"count_name" => "NE 24/1 KH"
"order_qty" => 5150
"balance_qty" => 5150
"stock_qty" => "45420.85"
"order_req" => 0.0
]
]
I try to do it by two foreach loop, but it's didn't work. it's print every data multiple time. so is there anyone to help me, please.
Unionof the 2 queries should be enough. No need of PHP stuff.