i have one table with two columns as shown in picture
at the execution of page user enter the start and end date.
now what i need to calculate is total amount.
for example, if user put
start date: 18-jan-2010
end date: 23-jan-2010
then he has 2 dates in first options (20$) and 3 dates in second options (26$) so total will be (56$).
first i want to calculate in sql
1. how many days in first range (if any this depends on supplied dates from user)
2. how many days in 2nd range (if any this depends on supplied dates from user)
3. how many days in 3rd range (if any this depends on supplied dates from user)
then
we will multiply days with Amount in php for each range.
at the end i want to get grand total also in php.
Thanks