Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6813471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:34:27+00:00 2026-05-26T20:34:27+00:00

Quick question/clarification required here. I have a DB table that will quite possibly have

  • 0

Quick question/clarification required here. I have a DB table that will quite possibly have simultaneous updates to a record. I am using Zend Framework for the application, and I have read about two directions to go to avoid this, first being table locking (LOCK TABLES test WRITE) or something like that, will go back and re-read how to do it exactly if that is the best solution. The second being transactions: $db->beginTransaction(); … $db->commit();

Now ‘assuming’ I am using a transactional storage engine such as InnoDB, transactions seem like the more common solution. However does that avoid the following scenario:

User A is on a webpage -> submits data -> begin transaction -> read row -> calculate new value -> update row -> save -> commit

User B is on the same webpage at the same time and submits data at the same time, now lets just say it is almost simultaneous (User B calls the update function at a point between begin transaction and commit for User A’s transaction) User B relies on the committed data from User A’s transaction before it can achieve the accurate calculation for updating the record.

IE:

Opening value in database row : 5 User A submits a value of 5. (begin
transaction -> read value (5) -> add submitted value (5+5=10) -> write
the updated value -> save -> commit)

User B submits the value of 7. I need to make sure that the value of
User B’s transaction read is 10, and not 5 (if the update isn’t done
before read).

I know this is a long winded explanation, I apologize, I am not exactly sure of the correct terminology to simplify the question.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:34:28+00:00Added an answer on May 26, 2026 at 8:34 pm

    transactions doesn’t ensure locking. The whole block in transaction is treated as atomic update to db (if anything fails in between all previous changes of this block are rollback). So, two transactions running in parallel can update same row.

    You need to use both.

    Transaction do
     row.lock
     update row
    end
    

    see, if row level locking can make it easier for u.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick question. What do you think, I have a few sites that use a
quick question really: I have this code: using System; using System.Collections.Generic; using System.Linq; using
Quick question here, I'm using Visual Studio to create an Outlook add-in. I've created
Quick question just to verify something. If I have an HTML5 mobile advertisement that
Quick question: If I have a very large function/sub in a class that is
Quick question. There is a legacy website (that is not under my control and
Quick question, I was curious if there is any difference between a database table
Quick question, Instruments is reporting a leak here... MyViewController *myVC = [[MyViewController alloc] initWithNibName:@myView
Quick question, hopefully I am just missing something simple. Ok I have one class
Quick question: When I'm in Google Reader, it will flash and pop up a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.