The wonderful problem of Javascript-mysql update

Source: Internet
Author: User
Tags mysql update mysql command line
Update table_xxx set a=a+1 where documentid=123

If the database is 10, then 11 is executed.
But the final result is always 12, I have been depressed for a day, how to do. The program does not have any problems, I use the MySQL class, and the original SQL have tried, all this problem, before the development of the time also did not encounter, the development of a year encountered such problems can not solve, feel is a git, ask the great God advice

Database structure:

CREATE TABLE comment_top_foot (id int(10) NOT NULL AUTO_INCREMENT,documentid int(10) NOT NULL,commentid int(10) NOT NULL,topnum int(10) NOT NULL DEFAULT '0' COMMENT '对评论顶的数量',footnum int(10) NOT NULL DEFAULT '0' COMMENT '对评论踩的数量',PRIMARY KEY (id)) ENGINE=MyISAM AUTO_INCREMENT=1500 DEFAULT CHARSET=latin1

Just now I ran the script under Linux, the database is Gay Yes, but I in the browser access to the script after the database value plus 2, this is God horse reason!

Find out why, in the colleague's browser is normal, I replaced Firefox or IE is normal, now with the Google, the problem, the only reason to wonder why Google Browser will be wrong. Depressed...

Reply content:

Update table_xxx set a=a+1 where documentid=123

If the database is 10, then 11 is executed.
But the final result is always 12, I have been depressed for a day, how to do. The program does not have any problems, I use the MySQL class, and the original SQL have tried, all this problem, before the development of the time also did not encounter, the development of a year encountered such problems can not solve, feel is a git, ask the great God advice

Database structure:

CREATE TABLE comment_top_foot (id int(10) NOT NULL AUTO_INCREMENT,documentid int(10) NOT NULL,commentid int(10) NOT NULL,topnum int(10) NOT NULL DEFAULT '0' COMMENT '对评论顶的数量',footnum int(10) NOT NULL DEFAULT '0' COMMENT '对评论踩的数量',PRIMARY KEY (id)) ENGINE=MyISAM AUTO_INCREMENT=1500 DEFAULT CHARSET=latin1

Just now I ran the script under Linux, the database is Gay Yes, but I in the browser access to the script after the database value plus 2, this is God horse reason!

Find out why, in the colleague's browser is normal, I replaced Firefox or IE is normal, now with the Google, the problem, the only reason to wonder why Google Browser will be wrong. Depressed...

Under consideration, do you prevent duplicate commit logic?
Grab the HTTP request and see how many requests have passed.

Http://stackoverflow.com/questions/19264616/mysql-update-query-is-executing-twice-in-chrome-but-once-in-mozilla

https://codebuildplay.wordpress.com/2014/03/06/chrome-loads-page-twice-sitecore-dms-gets-faulty-usage-data/

Can you put the code on, I'm in the local test right, I'm knocking on the MySQL command line

update ask_posts set state=state+1 where id=10;

The results obtained:

You should post the PHP code, and the problem is probably there.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.