On Sat, 2004-02-28 at 14:59, Ryan A wrote:
> Hey everyone...
> In the last 24 hours there have been questions on how to get the all the
> records of a day
> based on the timestamp and to check whether the current date/time is later
> than a timestamp,
> I have  a new one... how do you fetch all records between date1 and date2?
> 
> eg:
> you have some entries in a join_date (timestamp(4)) field for every day of
> Feb and need to
> get all records between sayyy... 7th Feb and 15th Feb..

There are many ways to go about this, here is one...

$qString =
    "SELECT * from your_table "
   ."WHERE TO_DAYS( db_date ) >= TO_DAYS( '$sDate' ) "
   ."AND TO_DAYS( db_date ) <= TO_DAYS( '$eDate' ) ";

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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

Reply via email to