Jump to content

mysql UPDATE only partially being performed


rwhirn

Recommended Posts

I have a very mature PHP/MySQL e-commerce website. It has been operating successfully for 5 years. It is hosted on its own dedicated server and is running PHP v5.2.9 and MySQL distro 5.0.58. The website is NOT static, I am frequently updating and enhancing features. However, I believe the issue I am having is NOT related to any changes made as it is occurring in code that has not recently changed.

 

In a nutshell, the topic title says it all. After 5 years of working fine, all of a sudden MySQL UPDATE statements are randomly only updating SOME of the fields in the query. It first was noticed in my "admin/control panel" page, i.e., only visible to the back office. The code for back office work is set to throw a "die(mysql_error())" on any failed queries so the office folks will tell me when there's an error. Thus I know that MySQL is NOT throwing an error when these "partial" updates are occurring. Also, I have checked "error_log" and there are no entries there nor are there any entries in "mysqld.log".

 

I know the first instinct is to say "bad data", but that should throw an error, or "missing data", but that just isn't possible. This is the simplest of UPDATE queries and easy to show.

 

The situation is this, when a new order comes in, someone in the back office displays it, selects their name as the person responsible for it from a drop down field and hits a "print" button. This calls a javascript print and then submits the page back to itself where it runs an UPDATE query on the order and updates three fields. It sets orderStatus to "Processing", it sets the employee field to the persons name from the drop down and it sets a comments text field to "printed" plus the time and the person who printed it, again using the name from the drop down.

 

For over 80,000 orders this has worked just fine, never an error. Now, once every couple of days, while doing around 150 orders a day, one order DOESN'T get updated and no errors appear anywhere.

 

The other case where this is happening is much more complicated and involves the customer updating items in their cart. This uses a query updating more than 30 fields and all fields in the query will get updated except one, and not always the same one. Sometimes it will be a text field, sometimes a numeric field. Again this is only happening once or twice out of every several hundred updates a day.

 

There just doesn't seem to be any logical "coding" reason why this is happening. Could it be database corruption? Should I delete my whole database and rebuild from an export?

 

Anyone ever heard of anything like this or have any good ides?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.