简体   繁体   English

“致命错误:未捕获的错误:调用成员 function bind_param() on bool”它说

[英]"Fatal error: Uncaught Error: Call to a member function bind_param() on bool" it says

please help it said请帮助它说

Fatal error : Uncaught Error: Call to a member function bind_param() on bool in C:\xampp\htdocs\bmi\connect.php:18 Stack trace: #0 {main} thrown in C:\xampp\htdocs\bmi\connect.php on line 18 Fatal error : Uncaught Error: Call to a member function bind_param() on bool in C:\xampp\htdocs\bmi\connect.php:18 Stack trace: #0 {main} thrown in C:\xampp\htdocs\bmi\连接.php上线18

 if ( isset($name) || isset($weight) || isset($height) || isset($gender) || isset($age) )
{
    $name = $_POST['name'];
    $weight = $_POST['weight'];
    $height = $_POST['height'];
    $gender = $_POST['gender'];
    $age = $_POST['age'];
   
}

    $conn = new mysqli('localhost', 'root', '', 'test');
    if($conn->connect_error){
        echo "$conn->connect_error";
        die('Connection Failed :' .$conn->connect_error);}
    else{
        $stmt = $conn->prepare("insert into registration(name, weight, height, gender, age)values(?,?,?,?)");
        $stmt->bind_param("siiss", $name, $weight, $height, $gender, $age);
        $execval = $stmt->execute();
        echo $execval;
        echo "Koneksi berhasil";
        $stmt->close();
        $stmt->close();
    }
    

?>

I would appreciate if someone could open a private session through dm on instagram or twitter so i could send my files and you could check where's the problem cause, but if it's too impossible then I wouldn't mind, just help me get through this coding before tomorrow bcs the deadline is tomorrow如果有人可以通过instagram或twitter上的dm打开私人session,我将不胜感激,这样我就可以发送我的文件,您可以检查问题的原因,但如果这太不可能了,那么我不会介意,帮我完成这个编码明天之前 bcs 截止日期是明天

You should use bindparam like this.你应该像这样使用 bindparam。

$stmt->bindParam(1, $name, PDO::PARAM_STR);
$stmt->bindParam(2, $weight, PDO::PARAM_INT);
$stmt->bindParam(3, $height, PDO::PARAM_INT);
$stmt->bindParam(4, $gender, PDO::PARAM_STR);
$stmt->bindParam(5, $age, PDO::PARAM_INT);

In addition, you must add as many question marks (?) as the number of column names you entered.此外,您必须添加与您输入的列名数量一样多的问号 (?)。

values(?,?,?,?) >>>> values(?,?,?,?,?)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP致命错误:调用成员函数bind_param() - PHP Fatal error: Call to a member function bind_param() PHP致命错误:调用成员函数bind_param() - PHP Fatal error: Call to a member function bind_param() 致命错误:在非对象错误上调用成员函数bind_param() - Fatal error: Call to a member function bind_param() on a non-object error 函数不起作用:PHP致命错误:在布尔值上调用成员函数bind_param() - Function not working: PHP Fatal error: Call to a member function bind_param() on boolean MySQL —致命错误:在非对象上调用成员函数bind_param() - MySQL — Fatal error: Call to a member function bind_param() on a non-object Mysqli PHP致命错误:在非对象上调用成员函数bind_param() - Mysqli PHP Fatal error: Call to a member function bind_param() on a non-object 致命错误:在C:\\ xampp \\ htdocs \\ index.php中以布尔值调用成员函数bind_param() - Fatal error: Call to a member function bind_param() on boolean in C:\xampp\htdocs\index.php 致命错误:使用更新查询在非对象上调用成员函数bind_param() - Fatal error: Call to a member function bind_param() on a non-object using Update Query 致命错误:在非对象上调用成员函数bind_param() - Fatal error: Call to a member function bind_param() on a non-object 严重错误:在非对象上调用成员函数bind_param() - FATAL ERROR : Call to a member function bind_param() on a non-object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM