when i run the below mysql query in mysql front end the value increase by one:
Query: update tableName set ColA=ColA+1
previous value: 12
value after running query(1st time): 13
value after running query(2nd time): 14
But when i run the same query through my php script then it's always update 2 by 2.
<?php
mysql_query("update tableName set ColA=ColA+1",$conn);
?>
previous value: 12
value after running query(1st time): 14
value after running query(2nd Time): 16
value after running query(3rd Time): 18
why it's happening?
PHP Version 5.4.24
Mysql Version: 5.5.14
IIS version: 7
Use like this
mysql_query("update tableName set `ColA`=ColA+1",$conn);
Or
mysql_query("update tableName set `ColA`=`ColA`+1",$conn);
This is not MySQL issue but PHP. Single and Double Quotes are different...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.