News articles grouped by month and year


php , mysql...

 

don't know if going answer here, looking bit of advice on how handle grouping of news articles months , each respective year make easier user navigate content. trying acheive effect:

 

2012

- july

- june

- march

- january

 

2011

- december

- october

- april

 

2010

- november

- idea hope

 

i have set mysql use 'date' field called fld_articledate (formatted yyyy-mm-dd). need structure recordset query select year , group it, need group month relative year, have no idea of begin. guess question two-part:

 

  • how group year?
  • how group month of year?

 

once have queries sorted, assume i'd print page with  repeat , nested repeat regions!

 

thanks.

 

mat

it depends how many articles expect have , how want display them.

 

if there aren't many articles, select using order fld_articledate desc. can display them using php conditional logic.

 

alternatively, can create individual queries

 

select * articles

where year(fld_articledate) = 2012 && monthname(fld_articledate) = 'june'

order fld-articledate desc



More discussions in Develop server-side applications in Dreamweaver


adobe

Comments