i want to create a php with mysql to do the following:
lets say that i have a shop i want to rent, rent will be weekly or monthly. I’m searching for the best way to create this table, so i can do easy queries to calculate free weeks or months.
EDIT
let say i have
ID, START_DATE,RENING_TYPE,CLIENT_ID
where Start_date is the start date for renting, and RENTING_TYPE is weekly or monthly
how should i run a query to know all the empty weeks or month so new clients may reserve that week/month
for example a client reserve July month another client reserve the first week in June, if a new client logged in to my system and want to check all the available weeks/months, how can i achieve that ?
This query should return all the free intervals between bookings. It gets all suspected free days (end day + 1) if they have not already been booked, then it searches to find the next booked day. Giving you output like this
You can then get the exact dates inbetween using PHP.
The query:
Note: I’m very rusty with SQL so the syntax will probably be off but I think the logic is sound. I hope this gives you a nod in the right direction at least!