mysql更新查询中的增量值 [英] Increment value in mysql update query
本文介绍了mysql更新查询中的增量值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将此代码用于提供+1分,但无法正常工作.
I have made this code for giving out +1 point, but it doesn't work properly.
mysql_query("
UPDATE member_profile
SET points= ' ".$points." ' + 1
WHERE user_id = '".$userid."'
");
$ points变量是用户的当前点数..我希望它加一..因此,例如,如果他喜欢5个点,则应为5 + 1 =6.但是它没有,只是更改为1
the $points variable is the user´s points right now.. I want it to plus one to it.. so example if he had like 5 points, it should be 5+1 = 6.. but it doesnt, it just changes to 1
我做错了什么?谢谢
推荐答案
您也可以执行以下操作:
You could also just do this:
mysql_query("
UPDATE member_profile
SET points = points + 1
WHERE user_id = '".$userid."'
");
这篇关于mysql更新查询中的增量值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文