- Edited
Attempting to calculate the total sums of price and quantity columns, then display the sum using 'sum_price'. The query functions, but I always end up with $0.00 as sum.
Query
mysqli_query($con,
"SELECT *, SUM(order_item_price) * SUM(order_item_quantity) AS 'sum_price'
FROM order_table, order_item, steam_lessons
WHERE steam_lessons.lessonid = order_item.order_plan
AND order_table.memberid != order_item.order_idmember
AND '".$_SESSION['memberid']."' = order_item.order_idmember
GROUP BY order_item.order_item_id
ORDER BY order_item.date DESC");
Portion where I read results of query for SUM total:
Sum Price: '.number_format($a3["sum_price"], 2).'