dqy1265 2014-10-18 12:59
浏览 17
已采纳

是否有可能通过PHP增加一个特定的列值(int)? [重复]

This question already has an answer here:

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>
  • 写回答

1条回答 默认 最新

  • douyi8315 2014-10-18 13:01
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度