I am going to be building a blog and have rattled my brains out on this but could someone please explain in much detail as possible how i would go about building a blog archive ?

I don't mean i want the php code just the logic behind it.

I not started on anything yet as want to get the logic rite, everything else i seem to be ok with but i cannot for the life of me think how i would build an archive for the blog.

Blog posts will be stored by month/year and just cannot think how i would go about it.

I have searched high and low on Google but all i end up getting is how to build an archive word press plugin etc (something along those lines)

Thanks for any help/advice!


6 Years
Discussion Span
Last Post by phplover

If every blog entry has a creation date in datetime format, you can build your archive on that with a simple query. From that mysql can easily extract the month and year, and sort on it.


You can try this sort of syntax:

GROUP BY YEAR(blog_date), MONTH(blog_date)


Hi ardav,

Thanks for the example. Looks very simple now lol.

Thank you! :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.