...

View Full Version : Help with room bookings



sayeed
01-31-2007, 10:19 PM
Hi i need a bit of help

i am creating a hotel reservation system using php and mysql. one of the criteria of the system is to prevent double booking taking place for example if 2 users book only one room which is availbele, then only one person should be allowed to get that.

i dont know if u am right in using a lock function please some one tell me how to use that to control concurrency

Len Whistler
02-01-2007, 04:28 AM
Have a room_number and booked table in the MySQL database. The room_number table would hold all the room numbers, and the booked table could hold some booking information when the form is submitted.

Your webpage would run a query and display only the rows that have no information in the booked table. So if room 234 is booked it doesn't show up, if the reservation is cancelled then the booked table becomes empty and will then display the room as being available.

guelphdad
02-01-2007, 05:35 AM
Please post helpful thread titles. if everyone posted such titles, the forum would be useless as to figure out what threads were about what.

to answer your question see the link in my signature.

gunman
02-01-2007, 07:44 AM
It depend on your database structure basically you could use like that


LOCK TABLES trans READ, customer WRITE;
select sum(value) from trans where customer_id= some_id;
update customer set total_value=sum_from_previous_statement
where customer_id=some_id;
UNLOCK TABLES;

guelphdad
02-01-2007, 01:10 PM
It depend on your database structure basically you could use like that


LOCK TABLES trans READ, customer WRITE;
select sum(value) from trans where customer_id= some_id;
update customer set total_value=sum_from_previous_statement
where customer_id=some_id;
UNLOCK TABLES;


Have you posted in the right thread? This doesn't seem to answer the OPs question.

StupidRalph
02-05-2007, 03:55 PM
to answer your question see the link in my signature.

The link in your signature has been a real life saver for the past couple of weeks. :thumbsup: I wouldn't be surprised if it answered 50% of the questions posted in this forum. Well done on the links Guelphdad. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum