-2
$column = "`0907001`='0',`0907002`='0',`0907003`='0',`0907004`='0',`0907005`='0'";
$date="01/01/2013";   
$sql_cmd = "UPDATE `$database`.`$table` SET ($column) WHERE `$table`.`Date` = '$date'";
if(!mysql_query($sql_cmd)) {
  die('inside AddUserToDataBase Error: ' . mysql_error());                      
}

在这里我得到一个错误错误是

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`0907001`='0',`0907002`='0',`0907003`='0',`0907004`='0',`0907005`='0') WHERE `C' at line 1

请帮助....我该如何解决这个问题........

4

2 回答 2

2

只需在查询中删除( )周围$columns

$sql_cmd = "UPDATE `$database`.`$table` SET $column WHERE `$table`.`Date` = '$date'";
于 2013-01-09T14:21:17.437 回答
1

删除列周围的括号。代替:

UPDATE TABLE table SET (column = value)

它应该是

UPDATE TABLE table SET column = value

于 2013-01-09T14:20:48.547 回答