Hello Again,

I'm having difficulty setting up the code to loop through my db grab all the products for the users request and then group the products by the items they belong to.

someone suggested something like:
PHP Code:
<?php
$arProductsByItem 
= array();
if (
$numProduct ) {
  
$i 0;
  while (
$row dbFetchAssoc($result)) {
    
$arProductsByItem[$row['ItemName']] = $row;
  }     
}
// example of later output
if (count($arProductsByItem) > 0) {
  
reset($arProductsByItem);
  while(list(
$Item,$arProd) = each($arProductsByItem)) {
    echo 
'Item: '.$Item.' - Products: ';

    
$prod = array();
    
reset($arProd);
    while(list(,
$row) = each($arProd)) {
      
$prod[] = $row['Name'];
    } 
    echo 
Implode(", "$prod);
  }
}
?>
Which I adapted - to get most of my out put correct - the problem is the second while loop only returns the first letter of the field (or number)

This is not what I want.

How can I loop through the db for the items and inside that loop loop through the item for its products?

My query is as follows:
PHP Code:
SELECT i.Name AS ItemNamei.ItemId as Idpd.ProductIdpd.Namepd.PriceRetailpd.ImagetnURLQtyInStockpack.PackageTypes.Name AS Size
        FROM product pd
item ipricecodeprice pcpitemfeatures itffeatures fpackaging packsize s
        WHERE f
.Name '$pageTitle'
        
AND pd.SizeId s.SizeId
        
AND pd.PackageId pack.PackageId
        
AND itf.FeatureId f.FeatureId
        
AND itf.ItemId i.ItemId
        
AND pd.ItemId i.ItemId
        
AND ClientPriceCode 'R1'
        
ORDER BY pd.Name 
Thanks for the help!