dongmu7335 2011-09-10 06:52
浏览 61
已采纳

php poll程序使用mysql

I'm working on a poll program and am wondering, so far all of the sample I've seen makes use of insert then counting the total votes for each answers. I find it redundant to have a table with a field of answers and a lot of yes, no and maybe

So I am thinking, is it efficient for me to use update instead of insert, for example, if a user vote yes, the yes field will increment? Will it introduce problems with accuracy if users simultaneously vote?

  • 写回答

3条回答 默认 最新

  • douhanxujiuji6098 2011-09-10 06:57
    关注

    Your database uses transactions, the update will be atomic. There's no problem with accuracy.

    UPDATE MyTable SET MyColumn=MyColumn+1 WHERE MyVoteID=123
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何扩大AIS数据容量
  • ¥15 单纯型python实现编译报错
  • ¥15 c++2013读写oracle
  • ¥15 c++ gmssl sm2验签demo
  • ¥15 关于模的完全剩余系(关键词-数学方法)
  • ¥15 有没有人懂这个博图程序怎么写,还要跟SFB连接,真的不会,求帮助
  • ¥15 PVE8.2.7无法成功使用a5000的vGPU,什么原因
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?