开发者

How to make an addition to a MySQL column?

I want to make a "like" sort of button. It should basically +1 a value on the database called 开发者_如何学GoLikes. I can simply retrieve the value, do the addition and insert it again but I'm wondering if there is an easier way. Thanks


UPDATE Likes SET likeCount = likeCount + 1 WHERE likeID = ?


If you need to keep track of a value, then it is necessary that you store it. In the alternative, you might want to consider using a normal text file if you don't already have a database running. Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜