Ok I urgently need to acieve something.
This is just for checking the availability of rooms, in other words, rooms not booked.
I'm having a database with rooms. I simply just want to book these rooms where applicable, and then conduct an availability search to see which roomrs are available or not.
So the thing is, I can not continue with my project, if I don;t exactly know how my tables in my mysql database will be designed, since the other work that I have to complete, relay on these tables.
Allright So I've tried to join the database tables, which might be a solution, but I'm simply too inexperienced to crack this one.
Ok let me give you an example of something that I did with the help of previous posts in this forum. This does not work with a database, and searches for a single date only. It then displays whether the room on the specific date is available or not. But this is getting me nowhere.
What 'd like to achieve, is that I will be able to, lets say, specify a arrival date, and a departure date. Then when conducting the search, the site has to display all available rooms, which is not booked, within the date range.
Just to say, I can somehow acieve this if I pre-define all the tables with a date colum, specifying 'available - yes or no' But since it will be unpractical to pre-insert every single date of the coming years, this will not work.
So, I just have to enter a arrival and departure date, where I will get the dates of all the rooms available within the specified date range. I don;t know how to set-up the tables either. So please, anyone.
Ok, here is the coding, but this is not what I want, but it might be a start.
<?php
$searched_for = "2009-03-06";
$start = new DateTime("2008-03-01");
$end = new DateTime("2008-03-15");
$searched_for = new DateTime($searched_for);
if ($searched_for>=$start && $searched_for<=$end) {
echo 'Im not available at '.$searched_for->format("Y-m-d");
} else {
echo 'Im available at '.$searched_for->format("Y-m-d");
}
?>