That doesn't quite work. Here is my code:
$sql = "SELECT Production.PartNo AS Part,
Production.QuantProd AS Quantity
FROM Production
WHERE $deptString
AND Production.ProdDate >=$startDate
AND Production.ProdDate <=$endDate";
$result = mysql_query($sql);
while ($resultArray = mysql_fetch_array($result)) {
echo $resultArray["Part"];
echo $resultArray["Quantity"];
echo '<br />';
}
This shows me the correct total for each part number. What I want is a grand total of those parts. When I add the code suggested by NogDog I get a incorrect total.