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.