Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: how to solve concurrent update in database |
|
Author |
|
peacemaker
Joined: 23 May 2008 Posts: 80
|
Posted: Mon 14 Sep '09 14:32 Post subject: how to solve concurrent update in database |
|
|
Hi all
I am planning to make a booking system for travel agency, the issues that i will have is that, if there are two users asking for same seat then how i should queue that thing or how should i solve that issue if one user book that seat and another user book same seat, but that seat is already booked.
How can i manage that, i search and found something like locking of tables, or firing a trigger before update , can any one help related to this, if any small script for example will be very much appreciated. i am using Mysql, does Mysql provides any solution like queuing the updates on their own.
Thanks in advance |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 14 Sep '09 20:02 Post subject: |
|
|
Mysql can update fields itself. Maybe you have a timestamp
e.g.
Code: |
`lastChange` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
|
Such is thing is easy to create with phpMyAdmin. There is also CURRENT_DATE which often easier to handle.
Form the logic to your problem:
Make a SELECT To see if that seat is booked.
Than do a next step like give out a message that it is booked or what ever.
One solution you be to have a virtual seat plan and show which seats are free
For a existing Queue take a look at PHPClasses.org |
|
Back to top |
|
peacemaker
Joined: 23 May 2008 Posts: 80
|
Posted: Mon 21 Sep '09 14:47 Post subject: Hi |
|
|
Hi james, thanks for your reply. I will go thru wat u said and will try to implement on it.
thanks |
|
Back to top |
|
|
|
|
|
|