It's a bit hard to explain here but I'll try my best to include all related information. You can ask me if you don't understand.
Above is the data I got and I wish to combine the same number (e.g 2016) to be displayed as shown below.
This is my code.
<?php
$years = mysql_query("SELECT DISTINCT YEAR(event_date) as years, DATE_FORMAT(event_date,'%b') as months from news WHERE status<>'deleted' and status<>'draft' ORDER BY years DESC");
while($page=mysql_fetch_array($years))
{ ?>
<div class="date">
<div class="year"><a href="<?php echo $sys_domain; ?>/news/index.php?year=<?php echo $page['years'] ?>&month=<?php echo $page['months'] ?>"><?php echo $page['years']; ?></a></div>
<div class="month"><a href="<?php echo $sys_domain; ?>/news/index.php?year=<?php echo $page['years'] ?>&month=<?php echo $page['months'] ?>"><?php echo $page['months']; ?></a></div>
</div>
<?php } ?>
May I know how to combine the year? I used "GROUP BY" but cannot, it hides the 2nd row of data. Or should I compare the value and combine it? But I have no idea how to do this. Please help, thank you.



