Finding out the first possible booking date with php
| From: | Merlin Morgenstern | Date: | Thu, 03 Dec 2009 08:26:43 +0000 |
| Subject: | Finding out the first possible booking date with php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-300235@lists.php.net to get a copy of this message | ||
Hello everybody,
I am pretty much stuck with a problem and I was hoping to find some help here with you guys.
A PHP Script with MySQL as DB has to find out the first possible booking period available. I can't figure out the logic behind and if there is a trick with PHP to do it.
Following facts:
- There can only be 3 bookings in the same time period
- I want to find out the first period available
- There should be a less as possible periods that are unbooked
Example:
Start End
1.12 14.12
4.12 18.12
5.12 19.12
In this example the first possible booking would be 14.12 - 28.12 as this is a time period where I can offer a place that holds a max of 3 bookings.
My Problem now is how to pull this info and process it?
Should I get all dates out of the DB and process them via PHP, or do a magical MYSQL Query (which by the way seems not to be possible in that case in my knowledge) ?
Let's asume we go with PHP. Has somebody an idea how to form that kind of logic?
Thank you for ANY help,
merlin