php booking calendar with db
certain days can't be booked seperatly and needed to be booked regarding
the set "block".
For ex. 01-04-2008 and 02-04-2008 need to be booked together.
So if only 1 of them is selected by client between his arrival date and leaving
date, error message shows up.
If both days are selected in clients staying dates array, the booking is ok.
I got the script working that if 1 of both days are selected, an error message shows up, but I'm struggling if all blocked days are selected the booking can
Here is what i got so far:
db : table 'dates' with 'blok' column, if value = "0", there is no block, if value ="1" there is a block on that day.
i get through the form the $arrival date and $end date,
my script get all days in between and are put together in array $Days.
Then i select all rows in db where value =1
$result=mysql_query("SELECT * FROM $table1 WHERE block =1") or die (mysql_error());
//Then during this while loop i check every value in my $Days array if they match.
foreach( $Days as $key => $value)
if ($value == $date)
//finaly the error message is printed
echo $block."is being blocked";
This works fine...however, how to : if all blocked days are selected by client the booking can continue?
I apreciate any help.