PHP MySQLI 调用未定义方法 mysqli_stmt::bind_params()


PHP MySQLI Call to undefined method mysqli_stmt::bind_params()

我的一个朋友目前没有在这个脚本上提供大量帮助,我目前正在更新我的旧脚本,但它会显示以下错误消息;

致命错误:调用未定义的方法 mysqli_stmt::bind_params()

    $stmt = $db->prepare( $sql ); 
    if (!$stmt) 
    { 
        die("Failed to prepare statement: " . $sql); 
    } 
    // here I only get the title, website, and summary from the <form> 
    // that posted to this page: 
    $title = $_POST["news_title"]; 
    $img  = $_POST["news_imgPath"]; 
    $desc  = $_POST["news_content"];
    $more  = $_POST["news_websitePath"];
    $stmt->bind_params("ssss", $title, $img, $desc, $more ); 
    if ( ! $stmt->execute() ) 
    { 
        die("Execution of bound statement failed: " . $stmt->error); 
    } 
    echo "Inserted {$stmt->affected_rows} correctly.<hr/>"; 
    $db->close();

致命错误:调用未定义的方法 mysqli_stmt::bind_params()

bind_param,而不是bind_params()

                         ^

你拼错了bind_param

$stmt->bind_param("ssss", $title, $img, $desc, $more );