是否有可能通过PHP增加一个特定的列值(int)? [重复]
This question already has an answer here:
- Increment a database field by 1 5 answers
I have a button on a page that I would like use to increase the value of a column in a particular row of my database by 1. I have an idea of how I will parse the info except not entirely 100% on the sql e within my 'bridging' php file.
I'm thinking it will be an update statement but I'm not sure whether I can use i++
or something similar to increase the values by one.
$result = mysql_query("UPDATE markers SET verification = "???" WHERE name="somename")
The system I'm trying to build is a bit of an upvote/downvote system which the current 'numbervalue' is stored in the db, for use elsewhere within the page.
How can I do this? Cheers
</div>
此问题已经存在 这里有一个答案: p>
-
将数据库字段增加1
5 answers
span>
\ n li>
ul>
div>
我在页面上有一个按钮,我想用它来增加特定列的值 我的数据库的行由1.我知道如何在我的'桥接'php文件中解析信息,除了不完全100%在sql e上。
我想它将是一个更新 声明,但我不确定是否可以使用i ++ code>或类似的东西将值增加一个。 p>
$ result = mysql_query(“UPDATE 标记SET verification =“???”WHERE name =“somename”) code> pre>
我正在尝试构建的系统是一个upvote / downvote系统,当前的“numbervalue”存储在db中,供页面中的其他地方使用。
我该怎么办? 干杯 p> div>
Yes you could increment them by one using your query with this:
$result = mysql_query("UPDATE markers SET verification = verification + 1 WHERE name='somename'");
Sidenote: And if possible, use a newer API which is mysqli or PDO instead.