如何編寫準備的更新語句?參考:mysqli::prepareMySQLi在PHP中準備了更新語句
我試圖寫它描述:
if ($stmt = $mysqli->prepare("UPDATE tblFacilityHrs SET title =? description = ? WHERE uid = ?")){
$stmt->bind_param('sss', $title, $desc, $uid2);
//Get params
$title=$_POST['title'];
$desc=$_POST['description'];
$uid2=$_GET['uid'];
$stmt->execute();
$stmt->close();
}
else {
//Error
printf("Prep statment failed: %s\n", $mysqli->error);
}
錯誤:
Prep statment failed: 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 'description = ? WHERE uid = ?' at line 1 Edited row.
是的,它首先讓它們變得更有意義! –