$parameter = $_GET["o"];
$result = decode($password, $parameter, $salt);
if (strtolower($result['statusmessage']) == 'ok') {
$uservar = $result['id'];
print PHP_EOL . $uservar . PHP_EOL;
print PHP_EOL . $vipstatus . PHP_EOL;
print PHP_EOL . $callstatus . PHP_EOL;
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "UPDATE user SET vipstatus='1', SET callstatus='1' WHERE username ='$uservar'";
print PHP_EOL . $sql . PHP_EOL;
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
到目前为止,用户的vipstatus设置为1
,但是callstatus设置为0
,我希望它也是1
。我做错了什么?
答案 0 :(得分:2)
错误在查询中,使用 SET 关键字一次:
$sql = "UPDATE user SET vipstatus='1', callstatus='1' WHERE username ='$uservar'";
答案 1 :(得分:2)
查询中不需要两次SET
,如下所示: -
$sql = "UPDATE user SET vipstatus='1',callstatus='1' WHERE username ='$uservar'";
注意: - SET
只需在更新查询中使用一次。
答案 2 :(得分:0)
将此更改为
$sql = "UPDATE user SET vipstatus='1', SET callstatus='1' WHERE username ='$uservar'";
此
$sql = "UPDATE user SET vipstatus='1', callstatus='1' WHERE username ='$uservar'";
注意:
UPDATE user SET vipstatus='1', callstatus='1', WHERE username
此行不起作用。 s='1', WHERE
的Cz,你可以看到(,
)逗号。
基本上都是这样做的错误。所以在被击中之前先学习它。