I'm sure this is simple, but I'm having a time trying to figure out how to add two fields from two different tables together.
<?php
include_once('conn/db.php');
$query = "SELECT SUM(`sold`) AS total FROM veggies";
$stmt = $con->prepare( $query );
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
echo "<small><u>Plants Sold</u>: {$total}</small>";
}
?>
The above code is just the total for one table field called sold.
I'm trying to add "sold" from the "veggie" table to another table with the same field name "sold", except it's from the "flower" table.
Essentially I'm shooting for sum(sold) from veggies + sum(sold) from flowers.
If you need a better explaination let me know.
Thanks.