This question already has answers here:
When to use single quotes, double quotes, and backticks in MySQL
                                
                                    (12个答案)
                                
                        
                                2年前关闭。
            
                    
我想更新我的数据库,但是它不起作用,请帮忙。
假设我有当前点(10点),我想加1点,但是它将当前点(10点)更改为1。
不加10等于1 = 11

$points = $user_home->runQuery("UPDATE tbl_users SET spoints = 'spoints' + 1 WHERE userID=:uid");
$points->execute(array(":uid"=>$_SESSION['userSession']));

最佳答案

您必须删除字段名称周围的引号或使用反引号,如下所示:

SET spoints = `spoints` + 1

OR

SET spoints = spoints + 1

09-13 03:37