1

I need to update a table called "pm" where the "id" column is the value in "$id" variable and the "id2 column value is 1. the columns need to update are "user1read" and "user2read". when im runnig it it says wrong syntax, can any body help?

UPDATE `pm_system`.`pm` SET (user1read='no', user2read='yes') 
WHERE (id='".$id."' and id2='1')

thanks.

4

4 回答 4

3

正确的语法在这里:

UPDATE `pm_system`.`pm` SET user1read='no', user2read='yes' WHERE id='".$id."' and id2='1'
于 2013-06-24T07:37:57.687 回答
1

像这样写你的查询..

UPDATE `pm_system`.`pm` SET user1read='no', user2read='yes' 
WHERE (id='".$id."' and id2='1')

或者

UPDATE `pm_system`.`pm` SET user1read='no', user2read='yes' 
WHERE id='".$id."' and id2='1'

不用放,()

于 2013-06-24T07:38:47.323 回答
1
$sql = "UPDATE pm_system.pm SET user1read='no', user2read='yes' WHERE (id='$id' and id2='1')";
于 2013-06-24T07:39:05.063 回答
1

试试喜欢

UPDATE `pm_system`.`pm` SET user1read='no', user2read='yes' 
WHERE (id='$id' AND id2='1')

考虑到这pm是你的表名

于 2013-06-24T07:34:58.077 回答