Jump to content

[SOLVED] CMS System To Select Data From Certain Months


podja

Recommended Posts

Hi,

 

I have started to code a CMS system for my new site. All the content is getting saved in a database to make it easy to update.

 

I want to have a drop down list that displays the months that have content, allowing you to click the month and be redirected to a page showing just content from that month.

 

How do I check the database to get the months into a drop down box?

 

The thing I am mainly struggling is just to get each month to display once.

 

Thanks in advance.

Well, how is the information being saved in your database?

 

Could you possible show us a few rows in that database just so we can get the idea of what type of data we're looking at? (also include the columns so we can better help you create a query)

Heres an example table:

 

 

id | Content | Month

 

1 | Content 1 | January 2008

 

2 | Content 1 | January 2008

 

3 | Content 2 | Febuary 2008

 

4 | Content 3 | Febuary 2008

 

5 | Content 4 | Febuary 2008

 

6 | Content 5 | March 2008

 

7 | Content 6 | March 2008

 

1 | Content 7 | April 2008

 

 

 

As you can see, there are 4 months, so I want only those 4 months displayed in the drop down list. However months like Febuary and March are displayed more than once and when I echo'd the values out the months appeared twice rather than once in the drop down list.

 

Thanks.

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.