I am working on a similiar problem.
First, remember that MySql stores date in a 'date' column formatted yyyy-mm-dd, so if you are going to display in on your page in another format you will need to use date and strtotime
Here is an example from my project:
date('Y-m-d', strtotime($_POST['departing']))
Ok, for the searching, I don't really have an answer but I thought I would participate since I will likely be asking the same questions anyway.
It is my assumptions that if we are using MySql DATE column types it will be easier as BETWEEN
should work properly without too many manipulations. If I am right, then:
$query="SELECT id FROM bookings WHERE $start_date !BETWEEN bookings.begin_date AND bookings.end_date";
should work (or a SELECT COUNT might be even quicker). That would tell us if the begin date was available (if no rows are returned the date is available).
I stumble with the next part, making sure the date is available through the entire range. I guess the long way would be to do the same for each day in the period. Any other ideas?
derksj: please update this thread if you come up with good answers elsewhere!