Jump to content

Year and Month Matrix


ee12csvt

Recommended Posts

Hello,

 

I need some advice on creating a overview page for a news archive that I am creating.

 

I stored the following details in a sql database called growl_news

 

id - Unique idenifier

publish - n or y

occDate - Date of event (XXXX-XX-XX format)

title - Title of the news clip

Details - details of the news clip

created - date event was entered on site

update - timestamp of record being updated

 

The page that the news is published is not a problem, I have that finished, but now I am trying to create a page which displays the years and months that any news item is included the database.

i.e

 

2005 - JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC

2007 - JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC

2008 - JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC

 

The months where no news is included would remain inactive, but the months where something has happened would be highlighted and include a link to a page showing all that months news. It is intended to infill the past news items in time to expand the database further, it may stretch back to the late 1950's, but I only want years to display that appear in the database (as shown 2006 is missing as an example of this)

 

I have had a couple of attempts using the YEAR() and MONTH() commands in sql along with DISTINCT commands, but as yet have been unable to get success.

 

If anyone can point me in the right direction, or even suggest it cannot be done like this, I would be most grateful.

 

Many Thanks

 

Phil

 

 

Link to comment
https://forums.phpfreaks.com/topic/195660-year-and-month-matrix/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.