-1

I am wanting to find information on how I can construct a ticket reservation system with PHP and MySQL.

The tickets available will be for individual events that have limited places available.

The system must:

  1. Display the correct number of available tickets at any one time
  2. Temporarily allocate a ticket to a customer (for specified time period) while they enter their payment details
  3. Prevent other customers from buying a ticket that someone else is in the process of paying for
  4. Re-assign tickets to an events available ticket total if an allocated ticket transaction fails or the user abandons payment

The system will hopefully be based upon the Ticketmaster approach. This allocates a customer a ticket and gives them x amount of time to purchase the ticket. During this time the ticket is unavailable for purchase by other customers. If the transaction fails or time runs out the ticket is de-allocated and can be purchased by another customer.

My simple question then is how can such a system be implemented? How do you think Ticketmaster have implemented such a system?

Im looking for a nudge in the right direction and any help appreciated.

j08691
  • 204,283
  • 31
  • 260
  • 272
drj201
  • 1,085
  • 1
  • 9
  • 13
  • 1
    Perhaps you are on the wrong site? This site is for programming questions, not hiring freelancers. – DanS Mar 09 '11 at 12:49
  • 1
    Don't forget the 999,999,999% "convenience" fees and surtax taxes - ticketmaster's system is probably 3 lines of code to handle the tickets, and 200 trillion lines to add all extra fees. (I exagerate, probably only 2 lines for the ticketing :p) – Marc B Mar 09 '11 at 14:27
  • 1
    DanS: I'm not asking for someone to code this for me. I'm asking for advice on the best way this might be achieved. Your comment was not helpful at all. I assume one day you were also a novice? Thanks. – drj201 Mar 10 '11 at 08:14

1 Answers1

7

On a very crude level: you'd assign a unique ID to each ticket. Then have a second table with an entry for each ticket that was currently 'holding'. If the transaction timed out or was cancelled you would delete that 2ndary record. If the ticket was sold you'd create an entry in a 3rd table. To find out which tix were still available you'd left join between the 'all tickets' table and the other two.

ethrbunny
  • 10,379
  • 9
  • 69
  • 131
  • Thanks ethrbunny. That was helpful (I would vote you up if I could). How would you maintain the timed period for purchase? A timestamped session? – drj201 Mar 10 '11 at 08:49
  • There are several ways to do this too.. the easiest probably being a 2ndary 'sweeper' process that would run every n-seconds and clean up the orphaned tix. You could also trap the process close from your server and clean up tix that weren't purchased. – ethrbunny Mar 18 '11 at 17:52