Hi,
I'm a bit stuck trying to get my code to output correctly, see below. It all works ok, but rather than displaying all news items, it only shows one for each month. What I need to do is group all news for a selected month with the month/year heading for that month. Hope this makes sense.
Any help greatly appreciated. SS
$theQuery="Select * from isnews WHERE active = '1' GROUP BY YEAR(date) DESC, MONTH(date) ORDER BY YEAR(date) DESC, MONTH(date) DESC";
$newsQuery=mysql_query($theQuery);
if(mysql_num_rows($newsQuery)>0) {
while ($newsResult=mysql_fetch_array($newsQuery)) {
$newDate = $newsResult['date'] ;
echo '<div class="date">' . date('F Y ',strtotime($newDate)) . '</div>';
echo '<ul class="press">';
echo '<li>
<img src="'.$wwwUrl.'images/news/'.$newsResult['image'].'" width="'.$newsResult['tnWidth'].'" height="'.$newsResult['tnHeight'].'" title="'.$newsResult['title'].'" alt="'.$newsResult['title'].'" />
<h3><a href="press-releases/'.$newsResult["id"].'/'.$newsResult["title"].'.php">'.$newsResult["title"].'</a></h3>
'.substr($newsResult['descrip'],0,100).'
<p><a href="press-releases/'.$newsResult["id"].'/'.$newsResult["title"].'.php">Read more</a></p>
</li>';
}
echo '</ul>';
} else {
echo 'We currently have no press releases available';
}