您好我一直在尝试更新我的表的状态,但我可以弄清楚为什么这个aint工作,它显示错误信息所以状态不更新
$uid = $_GET["uid"];
$query=$db->query("UPDATE INTO users SET status = 0 WHERE uid = '$uid'");
if ($query){
echo "ok";
}
else
{
echo "error.";
}
答案 0 :(得分:3)
它不应该是update into
UPDATE users SET status = 0 WHERE uid = '$uid'
答案 1 :(得分:2)
您的查询必须是您正在混合插入和更新查询
UPDATE users SET status = 0 WHERE uid = '$uid'
您需要了解差异
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
INSERT INTO table_name ( field1, field2,...fieldN )
VALUES ( value1, value2,...valueN );
答案 2 :(得分:1)
只需删除INTO
,就无法{i} UPDATE
查询。
$query=$db->query("UPDATE users SET status = 0 WHERE uid = '$uid'");