Jump to content


Photo

this is probably easy to solve..


  • Please log in to reply
2 replies to this topic

#1 dmarchman

dmarchman
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 11 August 2005 - 05:33 AM

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.

#2 Mattyspatty

Mattyspatty
  • Members
  • PipPipPip
  • Advanced Member
  • 76 posts
  • LocationEngland :D

Posted 20 August 2005 - 02:21 AM

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.

View Post


using that date format, sorting just months may be a lil tough..
ok, so my PHP is a bit rusty... my replies are 90% ok.
the other 10% either have syntax errors or are the "hard solution"
http://www.php.net  http://www.google.com - Are your friends!

I have a C++ problem with 'keybd_event' in certain applications. if you can help me PM me! :P
Needs motivation to create another quick cash website. I need a new TV

#3 dmarchman

dmarchman
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 22 August 2005 - 11:23 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users