我在下面的代码中收到以下错误.
Warning: mysqli_stmt::bind_param(): Number of variables doesn’t match number of parameters in prepared statement in C:\wamp\www\purev\admin\edit.php on line 39
if(isset($_POST['submit'])){
$post_title = $_POST['posttitle'];
$content = $_POST['content'];
$author_name = $_POST['authorname'];
$category = $_POST['category'];
$post_date = $_POST['postdate'];
if(isset($_FILES['image']['name']) && ($_FILES['image']['name'] !="")){
$size=$_FILES['image']['size'];
$temp=$_FILES['image']['tmp_name'];
$type=$_FILES['image']['type'];
$image_name=$_FILES['image']['name'];
unlink("../images/"."$image_name");
move_uploaded_file($temp,"../images/$image_name");
}
//-------------------UPDATE POST------------------------
$sql =
"UPDATE blog_posts
SET post_title='$post_title',
content='$content',
author_name='$author_name',
category='$category',
post_date='$post_date',
image='$image_name'
WHERE post_id='$id'";
$stmt = $con->prepare($sql);
$stmt->bind_param("sssssii", $post_title, $content, $author_name, $category, $image_name, $post_date, $id);
$stmt->execute();
不使用预准备语句查询工作.你有任何想法如何解决这个问题?