Ok so I am a lil confused how to go about this and seek some help..
I have a mysql db that has a column named quantity and another called price_paid
what I want to do is take and add up the entire column of price_paid but to also take into account a quantity higher than 1.
Ex..
_____________ ______________
| quantity | | price_paid |
-------------- ---------------
1 2.99
2 9.99
1 1.99
How would I create the php / mysql to make that = a total of 24.96 ?
So far I am able to get the total of price_paid but what I have doesn't take into account the quantity column and it's value.
$comic_totals = "SELECT sum(price_paid) AS value_sum FROM `comic_db`.`comic_db`";
$total_db = mysqli_query($comic_connect, $comic_totals);
if(!total_db){
echo "Failed";
}
$tot_array = mysqli_fetch_assoc($total_db);
$sum = $tot_array['value_sum'];
echo "$".$sum;
so how do I turn that into what I need? Thanks