Just under }ELSE{ is the $itemData reference
Which brings up another interesting point... I don't really want the ELSE statement, but it fails completely without it.
arrays are somewhat new to me when calculating from them. I have researched the world over and can't seem to find anything that applies to this problem.
Sorry about the indents, this code has been worked and reworked so many times just trying to get it to work, I'm half way there, at least it prints from the database now in relation to the items under min.
Thanks for the heads up on the <?php highlighting.
<?php
include_once 'db.php';
echo "<hr>";
$deflist=mysql_query(
"SELECT l.groccat, l.quant, b.grocname, b.min, b.tobuy FROM inven l,groc b WHERE l.groccat = b.grocname");
while ($all = mysql_fetch_array($deflist)) {
$results[$all['grocname']][] = array ('quant' => $all['quant'], 'min' => $all['min'], 'groccat' => $all['groccat'], 'tobuy' =>
$all['tobuy']);
}
foreach ($results as $groName => $groData)
IF ($groName['quant'] < $groName['min']){
Echo "You need " . (($itemData['tobuy'] + $itemData['min']) - ($itemData['quant'])) ." - " . $groName ."<br>";
{
foreach ($groData as $itemNum => $itemData)
//Echo "You need " . (($itemData['tobuy'] + $itemData['min']) - ($itemData['quant'])) ." - " . $groName ."<br>";
{
}
}
}
?>