Jump to content


Photo

mysql date search


  • Please log in to reply
1 reply to this topic

#1 jentino28

jentino28
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 06 July 2006 - 08:36 AM

Hi guys,
I looked around and googled but can't find a straight answer.

I designed a website where i have my links as :

            Today | Yesterday | Past 5 days | Past 7 days | Past month

i can do "today" and "yesterday" mixing php's time functions and mysql but im struggling with "7 days".

i attempted using DATE_SUB(CURDATE(),INTERVAL 7 DAY); but it only pulls queries found on the last 7th day, not between now and seven days.which is what im looking for.

Please help me.


thanks. ;)


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 06 July 2006 - 04:17 PM

You want "WHERE yourDateColumn - INTERVAL 7 DAY <= NOW()".
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users