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

Reply via email to