News articles grouped by month and year
PHP and MySQL...
Don't know if I am going to get an answer here, but I am looking for a bit of advice on how to handle grouping of news articles into months and each then into the respective year to make it easier for the user to navigate content. I am trying to acheive this effect:
2012
- July
- June
- March
- January
2011
- December
- October
- April
2010
- November
- You get the idea I hope
I have set up MySQL to use a 'date' field called fld_articledate (formatted as YYYY-MM-DD). I need to structure my recordset query to select by year and group it, but then I also need to group by month relative to that year, but I have no idea of where to begin. So I guess my question is two-part:
- How do I group by year?
- How do I then group by month of that year?
Once I have my queries sorted, I assume I'd print to page with repeat and nested repeat regions!
Thanks.
Mat
