Simultaneous Data Update - "Record Locking"

Thread Solved

Join Date: Apr 2009
Posts: 16
Reputation: SQL_n00b is an unknown quantity at this point 
Solved Threads: 1
SQL_n00b's Avatar
SQL_n00b SQL_n00b is offline Offline
Newbie Poster

Simultaneous Data Update - "Record Locking"

 
0
  #1
Sep 11th, 2009
What is the best way to update a record when 2 users of my site happen to edit it simultaneously?

For example, assume the following scenario:
Let's say users John Doe and Jane Doe log into my site and happen to view the below record simultaneously.
---------------------------------------------------------------------------------
Bruce Wayne | Gotham City | (910)000-0000
---------------------------------------------------------------------------------
If John edits the above phone number to (910)000-0001 and Jane changes it to (910)000-0002 - at the same time - what value do I update the DB with?

How do I prevent users overwriting each others' updates? Is something like <cflock> useful in this case or is it purely an SQL thing?

Thanks!
Last edited by SQL_n00b; Sep 11th, 2009 at 10:46 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Simultaneous Data Update - "Record Locking"

 
0
  #2
Sep 11th, 2009
The lock is written into the query. You'll need to check into the correct syntax for your specific database.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC