logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



how to solve concurrent update in database

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
peacemaker



Joined: 23 May 2008
Posts: 80

PostPosted: Mon 14 Sep '09 14:32    Post subject: how to solve concurrent update in database Reply with quote

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: 6255
Location: Germany, Next to Hamburg

PostPosted: Mon 14 Sep '09 20:02    Post subject: Reply with quote

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

PostPosted: Mon 21 Sep '09 14:47    Post subject: Hi Reply with quote

Hi james, thanks for your reply. I will go thru wat u said and will try to implement on it.
thanks
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1