Hey All,
I am trying to show the hotel room prices per each day for that i query the database between a date let's say between '2010-09-01' and '2010-10-30'.
Currently on my database the records only show up till '2010-10-07' but i would like that even if doesn't has records in database to follow the rest of the days till '2010-10-30' that will be shown as not/available.
I tried this by using a loop throw the date variables and then per each day i would query the database for records, the problem is that i have 16000 records and it takes quite a while to show the results.
this the code i am using now:
$start_date = '2010-09-01';
$check_date = $start_date;
$end_date = '2010-10-30';
$i = 0;
while ($check_date <= $end_date) {
$sel_rate = mysql_query("select day_add,price from contract_rates
where day_add='".$check_date."' ");
$get_rate = mysql_fetch_array($sel_rate);
echo "date: ".$check_date." Price:".$get_rate['price']."<br>";
$check_date = date ("Y-m-d", strtotime ("+1 day", strtotime($check_date)));
$i++;
}
If someone know's a better solution i would appreciate it
thanks