Hi, I am pretty new at PHP and need some help. I've been searching on Google for a while now and came across this site a few times in the results, but I couldn't find the exact answer I was looking for - so I decided to register and post the question directly here. Here goes: I have two tables: resourceLib and resourceLibLinks In resourceLib, the columns are CAT, CATDESCRIPT, GENDESCRIPT and ORDERROW In resourceLibLinks, the columns are CAT, LINK, ORDERROW What I want to display to the end user are results like this: [u]CATDESCRIPT for CAT1[/u] [i]GENDESCRIPT for CAT1[/i] LINK1 for CAT1 LINK2 for CAT1 LINK3 for CAT1 LINK4 for CAT1 [u]CATDESCRIPT for CAT2[/u] [i]GENDESCRIPT for CAT2[/i] LINK1 for CAT2 LINK2 for CAT2 LINK3 for CAT2 LINK4 for CAT2 Here is the code I have so far: [code]$query = "SELECT * FROM resourceLib INNER JOIN resourceLibLinks WHERE resourceLib.CAT=resourceLibLinks.CAT ORDER BY resourceLib.ORDERROW"; $result = mysql_query($query) or die(mysql_error());[/code] And then I have this to display the results, which is obviously not working and where I need your help! [code]<?while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<span class=\"headerTextUL2\">" . "{$row['CATDESC']}</span>" . "<p class=\"contentText\">" . "{$row['DESCRIPT']}<br>" . "</p>"; } ?> [/code] I think what I need to do is something like this: For each CAT If new CAT Print CAT name Else For each LINK Print LINK Next LINK Next CAT But, I'm not real sure if that is correct and if it is, I'm not sure of the syntax. I hope I've explained this well enough. I appreciate any of your help!