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!

The lock is written into the query. You'll need to check into the correct syntax for your specific database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.