date problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

I have a database that holds car rental info
DB:
carrental_from (datetime field)
carrental_to (datetime field)
carrental_price (datetime field) [rates are per hour]
The values I have are like:
0000-00-00 00:00:00,0000-00-00 07:00:00,10 (all year around 00:00-07:00)
0000-00-00 07:00:00,0000-00-00 00:00:00,20 (all year around 07:00-00:00)
2005-12-22 07:00:00,2006-01-02 00:00:00,15 (christmas period 00:00-07:00)
2005-12-22 00:00:00,2006-01-02 07:00:00,25 (christmas period 07:00-00:00)

The user selects dates ($from - $to) to rent a car and he gets the price accordingly. I can do a (($to-$from)/60/60) and get the total number of hours but depending on the date and time you get a different result. Can anyone help with the SQL?

Thanks in advance

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux