开发者

How to make an addition to a MySQL column?

开发者 https://www.devze.com 2023-03-24 06:01 出处:网络
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 wond

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

精彩评论

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