[英]"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.