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 6671511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:23:49+00:00 2026-05-26T03:23:49+00:00

I am a newbie in php and working on a webservice to increase itemQuantity

  • 0

I am a newbie in php and working on a webservice to increase itemQuantity from iphone end. When the user hits the + button to increase quantity of an item multiple times , then it some times does not accurately increase the quantity. iphone is sending me increased quantity everytime. I mean 26 then 27 then 28.

But when I tried to debugged it I found some time it firstly serve the database with 28 then update it to 27 . can anybody please help ? function I am using is as following….

function update_query($tblName,$queryArr,$condition)
{
if(!empty($this->_database)){
if(!mysql_select_db($this->_database, $this->_link) ) 
{
 $this->_errorstr = "Couldn't change database: ".$this->_database."
 My-SQL     Error ".mysql_error($this->_link);
 }
 }
 $fields=@array_keys($queryArr);
 $values=@array_values($queryArr);
 $update="";
 for($i=0;$i<count($values);$i++)
 {
$update.="$fields[$i]='".addslashes($values[$i])."',";
 }
 $update=substr($update,0,-1);
  $query="update $tblName set $update $condition";
//  echo $query


   //echo  $query."<br>";
 //die;
  $this->_errorstr = "";
  $this->_query = $query;
  $this->_result = mysql_query( $this->_query, $this->_link );
  if ( ! $this->_result )
  {
    $this->_errorstr = "Error : ".mysql_error( $this->_link );
    $this->_success = false;
  }
 else
 {
   $this->_success = true;

}
return $this->_success;
 }
  • 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-26T03:23:50+00:00Added an answer on May 26, 2026 at 3:23 am

    What happens if two requests arrive at the same time to your application and both read the same value from the db?

    Use SET quantity = quantity + 1 in you mysql query instead.

    This does not solve the display problem in your iphone application, but at least, the users command has been stored inside the data.

    To solve the display problem, you need to change the design of your application. For example, increase on client side and store later on.

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

Sidebar

Related Questions

I'm a PHP newbie working a some scripts to display some news articles from
I'm a real newbie with php and MySQL. Now I'm working on the following
I'm a newbie php guy. I have 1 string output from Drupal's date module
I'm completely newbie in PHP. I have tried example code from this site .
I am a newbie to PHP development. I tried following code sample from PHP5
I am a newbie in php. I have a form with multiple checkbox values.
i am newbie to iphone programming. I am working on an iphone project. My
I am a PHP newbie and am working on a basic form validation script.
php newbie here..I need some PHP help ideas/examples on how to import data from
I'm kind of a newbie with PHP so please bear with me. I would

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.