Not a nested array, a simple 'if' statement... Something like: $Info = mysql_query("SELECT ..... $oldCat = ""; while ($SRecord = mysql_fetch_array($Info, MYSQL_ASSOC)) { If $oldCat != $SRecord["ProdCategory"] { /* Print your special Header row */ echo "<TR><TD>Category = $Category </TD></TR>"; } /* now all you need is $Model - $Description - $Price */ $Model = htmlspecialchars($SRecord["ItemModel"]); $Description = htmlspecialchars($SRecord["ItemDescription"]); $Price = htmlspecialchars($SRecord["ItemPrice"]); ?> <tr> <td><font face="Arial" size="-1"><? echo("$Model"); ?></font></td> <td><font face="Arial" size="-1"><? echo("$Description"); ?></font></td> <td><font face="Arial" size="-1"><? echo("$Price"); ?></font></td> <? } ?> Good Luck, Frank On 3/8/04 12:50 PM, "php-db-digest-help@xxxxxxxxxxxxx" <php-db-digest-help@xxxxxxxxxxxxx> wrote: > > From: "Aleks @ USA.net" <aleks.k@xxxxxxx> > Reply-To: <aleks.k@xxxxxxx> > Date: Mon, 8 Mar 2004 15:50:01 -0500 > To: "PHPDatabase List" <php-db@xxxxxxxxxxxxx> > Subject: Group inner join results > > Hi all, > > I thought I saw the answer to this question on here but can not find the > answer .. > So, > > I am doing an inner join on 2 tables and displaying the result as follows: > > Code========================================================= > <table cellspacing="2" cellpadding="2" border="0"> > <tr> > <td><font face="Arial" size="-1"><b>Cat#</b></font></td> > <td><font face="Arial" size="-1"><b>Category</b></font></td> > <td><font face="Arial" size="-1"><b>Model</b></font></td> > <td><font face="Arial" size="-1"><b>Description</b></font></td> > <td><font face="Arial" size="-1"><b>Price</b></font></td> > > </tr> > <? > > $Info = mysql_query("SELECT Table1.CatID, Table1.ProdCategory, > Table2.ItemID, Table2.ItemDescription, Table2.ItemModel, Table2.ItemPrice > FROM Table1 LEFT OUTER JOIN Table2 ON Table1.CatID=Table2.CatID ORDER BY > Table2.ItemID"); > > while ($SRecord = mysql_fetch_array($Info, MYSQL_ASSOC)) { > > $CatID = htmlspecialchars($SRecord["CatID"]); > $Category = htmlspecialchars($SRecord["ProdCategory"]); > $Model = htmlspecialchars($SRecord["ItemModel"]); > $Description = htmlspecialchars($SRecord["ItemDescription"]); > $Price = htmlspecialchars($SRecord["ItemPrice"]); > > ?> > > <tr> > <Td><font face="Arial" size="-1"><? echo ("$CatID"); ?></FONT></A></td> > <td><font face="Arial" size="-1"><? echo("$Category"); ?></font></td> > <td><font face="Arial" size="-1"><? echo("$Model"); ?></font></td> > <td><font face="Arial" size="-1"><? echo("$Description"); ?></font></td> > <td><font face="Arial" size="-1"><? echo("$Price"); ?></font></td> > <? > } > ?> > > </tr></table> > > Code====================================================================== > > The output of above is > > ---------------------------------------------------------------------------- > - > | Cat# | Category | Model | Description | Price > ---------------------------------------------------------------------------- > - > | $CatID | $Category | $Model | $Description | $Price > ---------------------------------------------------------------------------- > -- > > > What I need to do is build a table display where the output is grouped by > Category. > > Like this: > > --------------------------------------------------- > | Category = Ist $Category > --------------------------------------------------- > | $Model - $Description - $Price > --------------------------------------------------- > | Category = 2nd $Category > --------------------------------------------------- > | $Model - $Description - $Price > --------------------------------------------------- > | Category = 3rd $Category > --------------------------------------------------- > | $Model - $Description - $Price > ----------------------------------------------------- > > I think that I can do this > with a nested array... anyone have an idea?? > > THanks in advance... > > Aleks -- Frank Flynn Poet, Artist & Mystic -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php