calculate amount on dates difference

German_Killa

New Member
i have one table with two columns as shown in picture
ja1CB.jpg
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\[code\] start date: 18-jan-2010 end date: 23-jan-2010\[/code\]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\[code\]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)\[/code\]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
 
Back
Top