![]() |
check rental item availability PHP MySQL
I am making a scheduling application for a rental company. They make reservations and rent out items. When they try to make a reservation, I need to check each item's availability. I've tried multiple ways. Let me show you my latest attempt.
An example row from the database looks like this: id: "1" customer: "Drolex" dateList: "20090710 20090711 20090712 20090713" toys: "1 2" phone: "5555555" message: "This is a message." They enter the first and last date the item will be in use. I create a string with those dates and all dates between. The dates are separated by a space in the string and they are of the form year.month.day. I do a similar thing with the selected items (toys). PHP check availability code: PHP Code:
I think the problem is within the MySQL search (WHERE) technique. It doesn't give an error or warning. Do you see an easy fix? Do you have a better method for either storing or checking date overlaps based on first and last date? |
ever so quickly i came up with this example:
SQL: Code:
CREATE TABLE rentals (PHP Code:
wouldn't scale well though - but at least you get the idea :o |
| All times are GMT. The time now is 04:10 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0