rwhirn Posted August 19, 2009 Share Posted August 19, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/171025-mysql-update-only-partially-being-performed/ Share on other sites More sharing options...
fenway Posted August 21, 2009 Share Posted August 21, 2009 CHECK each table. Quote Link to comment https://forums.phpfreaks.com/topic/171025-mysql-update-only-partially-being-performed/#findComment-903216 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.