Let say we have following database table items
-----------------------------
ID | ITEM | PRICE | SALES |
-----------------------------
1 | item1 | 5.00 | 1 |
2 | item2 | 4.00 | 5 |
3 | item3 | 2.00 | 2 |
-----------------------------
This means item1
price was 5.00
and sold 1
times
how then we calculate total earning ! meaning for each item we will multpli its price with number of sale to get total earning for this item
$earning_per_item1 = $a1['PRICE']*$a1['SALES']; // for item1 = 5*1
But what if i want to get the total earning for all items?
This should be 29