Ticket Booking System

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am prototyping a ticket booking system and just wanted to ask a few

1 - What is the standard way of temporarily reserving a number of
tickets throughout the purchasing process (to stop other people
reserving those seats or whatever).

2 - What do you do to release these 'seats' if someone closes their
browser?  Is it just a cron job set for every 20 mins?

I am sure I have seen a solution to this before but can't find it now.



Re: Ticket Booking System

thehuby wrote:
Quoted text here. Click to load it

Hopefully you are using a database to store the information...
add a columns called
rsvd_date and purchased_date,
rsvd_by, purcased_by in your "SEATS" table when someone "reserves" them update  
those seats with the time they were reserved and the username that reserved  
them.  That way you can go back to their "reservation" should they get  
disconnected before they purchase them.

Then run a job - say - every 3 hours and if there is a reserved date and no  
purchased date and the reservation is > 2 hrs old (or however long you want them  
to be able reserve the seats) then update the seat and set the reserved  
date/username to NULL.

You MUST store this stuff in the db as your browser and/or server-side PHP  
scripts run as autonomous transactions.

What that also means is that if 2 people try to reserve the same seat at the  
same time, you must make sure you trap for that occurrance.  (only update the  
record if the reserve_date AND purchase_date is null... rows update something > 0)

Michael Austin.
DBA Consultant -
Oracle Rdb/Oracle RDBMS/MySQL and most any other ANSI-standard SQL-based db
Donations welcomed. Http://www.firstdbasource.com/donations.html

Site Timeline