SELECT m.manufacturers_id, m.manufacturers_name,
op.products_price,
op.products_quantity,
p.products_cost.....
I have these fields and I need to perform php arithmetic on the results, but keep them grouped based on their m.manufacturers_id
. This is the format of the result I need or desire.
Array(
[m.manufacturers_id]
[m.manufacturers_name]
[brands_total_sales ]
(sum of all the products_price * qty for the products in this manufacturers_id)
[products]
[0] =>
[op.products_price] = ''
[op.products_quantity] = ''
[p.products_cost] = ''
[1] =>
[op.products_price] = ''
[op.products_quantity] = ''
[p.products_cost] = ''
[2] =>
Then that repeats for all the products per unique manufacturers_id
. I guess basically the question is, is there a php function to manipulate an array of results to "sort" or "group" into manufacturers_id
Thanks in advance, an help or advise is greatly appreciated.