Jump to content

this is probably easy to solve..


Recommended Posts

i am working on a blog i made in dreamweaver and need some help 'cause i'm a MySQL n00b. I have a table in my db to store my blog entries (i named the table blogent) and when i enter a new blog a DATE field in that table named date_blogent that automatically stores the date i entered the blog in (with the date being stored as YYYY-MM-DD of course). I want to create links on a page that allow me to sort my blog entries by the month they were entered for example, i click on a link that says "July 2005" and the page filters through just the entries for that month. its probably something too simple and stupid for my feeble mind to comphrehend but any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/2444-this-is-probably-easy-to-solve/
Share on other sites

  • 2 weeks later...
  Quote
i am working on a blog i made in dreamweaver and need some help 'cause i'm a MySQL n00b. I have a table in my db to store my blog entries (i named the table blogent) and when i enter a new blog a DATE field in that table named date_blogent that automatically stores the date i entered the blog in (with the date being stored as YYYY-MM-DD of course). I want to create links on a page that allow me to sort my blog entries by the month they were entered for example, i click on a link that says "July 2005" and the page filters through just the entries for that month. its probably something too simple and stupid for my feeble mind to comphrehend but any help would be appreciated.

265554[/snapback]

 

using that date format, sorting just months may be a lil tough..

i used my brain and figured it out myself. this is the easy way and requires a little more management than an db solution, but it works. first i made some links on a page with the month and year and then pointed them to another page and passed a parameter for example:

 

june 2005 links to datesortbymonth.php?date_blogent=2005-06

 

then on the datesortbymonth.php page i made a recordset with the following query:

 

SELECT *
FROM blogent
WHERE date_blogent LIKE '%colname%'
ORDER BY date_blogent DESC

 

and the following Variable:

colname    1    $_GET['date_blogent']

 

basically in simple mode of the DW recordset dialog you set the filter keyword to "contains" as in date_blogent contains URL Parameter date_blogent.

 

worked all good and purty.

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.