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

  • SEARCH
  • Home
  • 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 9079811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:55:26+00:00 2026-06-16T19:55:26+00:00

I am making a webservice in PHP which does a series of calculations based

  • 0

I am making a webservice in PHP which does a series of calculations based on a select from a table and then updates the table afterwards with the new results.

However i want to prevent the case where another person is making a call to the same webservice while another person’s session is still doing an update.

Is it the right thing here to lock that entire table and then unlock it again? If so, how do i lock and unlock a mysql table using PHP pdo?

  • 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-06-16T19:55:27+00:00Added an answer on June 16, 2026 at 7:55 pm

    I posted a comment:

    Not a direct answer, but I don’t think this is any problem. The
    calculations and fetching data from the database is done within a few
    milliseconds. The chances or two people interacting at the same time
    is soooo small that most people don’t bother making a lock like this.

    But if these calculations are critical you could prevent this problem by adding a new field and simply call it occupied, busy or something like that.

    When you run your script, check if this field is set to for example 1, if it is, make the script sleep for 1-2-3 seconds and then retry. If this field is set to 0, update it to 1, do the calculations and set it back to 0 again.

    This would prevent two people from accessing the same values at the same time.

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

Sidebar

Related Questions

I am making a WebService in php which my website will use to query
When making calls to a webservice from an asp.net web application, to avoid creating
I'm making an app that receive datas from a webservice with an android app
i'm using .net webservice to catch response which i am getting from Android Application.
Here's my situation: I've successfully created a simple PHP webservice to pull data from
I created a webservice based on https which I am sharing with my friends.
I'm making an application that get data from webservice , insert it into a
I have some code I've written in PHP for consuming our simple webservice, which
I am making a call to a webservice from jquery and trying to return
I am in the middle of making an app using a PHP web service

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.