我尝试使用预处理语句更新mysqli数据库中的记录,但它对我不起作用。 请检查我的代码。 谢谢。
$editPostID = $_POST['postID'];
$newHeader = $_POST['newHeader'];
$newSubHeader = $_POST['newPostSubHeader'];
$newBody = $_POST['postBodyE'];
$oldCat = $_POST['oldCategory'];
$newCat = $_POST['newCategory'];
$sql = "UPDATE database.posts
SET postHeader=?, postSubHeader=?, postBody=?, category=?
WHERE ID=?";
$stmt = mysqli_stmt_init($myConn);
mysqli_stmt_prepare($stmt, $sql);
mysqli_stmt_bind_param($stmt, "sssss", $newHeader, $newSubHeader, $newBody,
$newCat, $editPostID);
mysqli_stmt_execute($stmt);
答案 0 :(得分:0)
mysqli_stmt_bind_param($stmt, "ssssd", $newHeader, $newSubHeader, $newBody,
$newCat, $editPostID);