Hi,
I'm building an app to book holiday cottages for a client.
A problem that I have is how to price a stay.
An user selects two dates. After validating that they're available etc, I then need to calculate the cost. The client has given me a pdf of his procelist, which I've turned into a db table.
He has 5 accommodation units, and each have different prices for different times of the year, and for different lengths of time (i.e. a week costs less than 7 nights)
Here's what I'm using http://www.gwilym.net/table_phpbuilder.html
and here's the SQL:
$sql = "SELECT 1_week FROM (SELECT * FROM tariffs WHERE to_date >= '2008-08-16') AS temp WHERE from_date <= '2008-08-30' ;";
Now, the above dates should cost £1800, but I only get back one record, for £900.
I think that the SQL is OK, and that I need to change the dates that I put into it, and maybe make more than one query, depending on the dates given.
Any advice? I'm pretty stuck.
Many thanks,
Mei