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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.