Can't you let the user tell you how many days back they want to count then
just use that value in a query with the date calculation functions available
in MySQL? You didn't specify your db type, but MySQL makes date calculations
pretty easy. Check that out and see if it gives you something usable.

HTH,
Rich

-----Original Message-----
From: Chris Payne [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 2:39 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Urgent DATA help needed


Hi there everyone,

 

My client suddenly dropped on me that they need to be able to search by
date, IE: the past 1 day, 3 days, 5 days or 7 days.  In the DB, the date
format is: 2001-07-05 (For example) but I have no clue how to count the days
in between to know how many days I am counting.  Say they have something at
the end of feb and it runs into march, I have no clue how to work this out.

 

Could anyone show me an example of how to do this?  So to take 2001-07-05
and add 3 days to it?  So if they choose 3 days, it would have to be CURRENT
DATE + 2 I guess, that way you would see all dates from CURRENT DATE OR date
= '2001-07-06' OR date = '2001-07-07'.

 

Any help really would be appreciated.

 

Chris

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to