SELECT * FROM news INNER JOIN categories ON news.category_id=categories.id ORDER BY category_id,date
//from the loop onwards...
$output ="";
$cat = "";
while($d = mysql_fetch_array($result)){
if($d['category'] != $cat){
if($output !="")$output .= "\n</ul>";
$output . ="\n<h3>${d['category']}</h3>\n<ul>";
}
$output .= "\n\t<li>{$d['headline']}<li>";
$cat = $d['category'];
}
if($output != "")$output .= "\n</ul>";
...
echo $output;
Not tested - off top of head.
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080