Jump to content

dates in mysql and related issue


kknixx

Recommended Posts

Just started with php and mysql. Im doing a hotel room reservation system for some 100 rooms. Customers come and register for room(s) between some date(check in) and some date(check out).

I need to check for the availability of rooms specifically on these days. If not already allocated the rooms will be allocated for him. I have created a mysql table with following fileds

username

email

checkin

checkout

roomsrequired

 

am not sure whether i require another table to manipulate the datas. I have no idea how to start with. any suggestions or help will be highly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/101634-dates-in-mysql-and-related-issue/
Share on other sites

I have basic knowledge to connect to mysql retrieve & update records. yes am doing this as hobby.

I dont want to do any payment process, its going to be just a demo. I have form ready and number of days in between calculated. But somehow not able to proceed further

to search for 1 day:

SELECT SUM(roomsrequired) FROM table WHERE  what ever the date syntax is

 

it's probably something like WHERE $date > checkin AND $date < checkout

or:

WHERE $date < checkin AND $date > checkout

 

if($row['SUM(roomsrequired)'] > 100)

{

echo 'No More Rooms ';

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.