When someone selects a service number, then it will pop down and only give the total one records. I want it to give to total from two tables..
<?php
$qry = mysql_query ("SELECT SUM(fruit) AS total FROM fruitinventory WHERE `fruitcolor` LIKE '%{$_POST['select']}%'");
$row2 = mysql_fetch_assoc($qry);
echo $row['total'];
?>
<?php
$qry = mysql_query ("SELECT SUM(fruitsmart) AS total FROM fruitrotten WHERE `fruitcolor` LIKE '%{$_POST['select']}%'");
$row = mysql_fetch_assoc($qry);
echo $row['total'];
?>
Then
I want the total of both rows to display then too.
<?php
$total return = $row+$row2
?>
You can consolidate your two database calls into a single query, and use the columns of the result as your variables to echo out:
Please, at the very minimum, use
mysql_real_escape_string()to help prevent against SQL injection attacks which is what your original code was wide open to.