Mysqli query not updating table with custid
// Create connection
$db = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$db) {
die("Connection failed: " . mysqli_connect_error());
}
//$query = "Select expiry from AcctSession where id ='$id' ";
echo $custid.$id; //works fine here
$query = "update sessions SET custid = '$custid' where id = '$id' ";
if (mysqli_query($db, $query)) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . mysqli_error($db);
}
我试过回显$ query 查询在命令行上运行正常但从php脚本触发时不会写任何结果(另外,也没有错误消息)