用于向查询添加第二个更新的格式

时间:2010-11-04 10:25:48

标签: php mysql

对于下面的查询,我想添加以下操作:将名为“flag1”的列更新为等于名为$uflag的变量。该格式的正确格式是什么?

UPDATE submission SET votes_up = $votes_up WHERE submissionid = $id

2 个答案:

答案 0 :(得分:3)

就像手册上说的那样

UPDATE 
  submission 
SET 
  votes_up = $votes_up, 
  flag1 = $uflag 
WHERE 
  submissionid = $id

http://dev.mysql.com/doc/refman/5.1/en/update.html

答案 1 :(得分:2)

UPDATE submission 
SET votes_up = $votes_up, flag1 = $uflag
WHERE submissionid = $id