Jump to content

sort database entries by month


fonster_mox

Recommended Posts

Hi, I do not know any php, just wanted to clear that up first!

 

I have a mysql database with the following fields: datetime, title, body and id. Where datetime is automatically inputted in the format

$datetime = date ("Y-m-d H:i:s");

 

What I would like now is a .php code which lists all months (eg, May 2009, June 2009) if they are present and then when you click on a month, you echo all news entries from that month, much like this - or possibly using a drop down box.

 

As I said I don't really know php so I don't know where to start, can anybody help me with the code or perhaps point me in the right direction?

 

Would be much appreciated, thanks for reading

Link to comment
https://forums.phpfreaks.com/topic/157483-sort-database-entries-by-month/
Share on other sites

Sorry I dont' think I explained my problem very well,

 

I already have sorted them, well I sorted them by id which is an auto incrementing number which essentially does the same thing.

 

What I would like is sort of an archive webpage, where the php generates a list of months, and clicking on a month would take you to all posts from that month.

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.