简体   繁体   English

如何使用PHP使MySQL的价值增加一倍

[英]How to make MySQL value Increase by one, using PHP

I have the following database table. 我有以下数据库表。

 id     article_content       article_views
   1       content..             48

I am trying to increase the value of the column article_views using mysql query. 我正在尝试使用mysql查询来增加article_views列的值。

I know I can fetch the number and then add +1 and then update the value, but is there any better way to do this? 我知道我可以获取数字,然后加+1,然后更新值,但是还有更好的方法吗?

Thanks :) 谢谢 :)

您的查询变为-

Update TABLE_NAME SET article_views = article_views+1 WHERE id = 'your_id'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM