podja Posted January 2, 2008 Share Posted January 2, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/84049-solved-cms-system-to-select-data-from-certain-months/ Share on other sites More sharing options...
kratsg Posted January 2, 2008 Share Posted January 2, 2008 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) Quote Link to comment https://forums.phpfreaks.com/topic/84049-solved-cms-system-to-select-data-from-certain-months/#findComment-427807 Share on other sites More sharing options...
podja Posted January 2, 2008 Author Share Posted January 2, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/84049-solved-cms-system-to-select-data-from-certain-months/#findComment-428113 Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 SELECT DISTINCT Month FROM tbl Quote Link to comment https://forums.phpfreaks.com/topic/84049-solved-cms-system-to-select-data-from-certain-months/#findComment-428114 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.