gpt4 book ai didi

php - (PHP) fatal error : Call to a member function bind_param()

转载 作者:行者123 更新时间:2023-12-04 02:07:26 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Fatal error: Call to a member function bind_param() on boolean [duplicate]

(12 个回答)


4年前关闭。




出于某种原因,我得到了。

Fatal error: Call to a member function bind_param() on boolean in D:\xampp\htdocs\tuitioncentre\stud-editprofile_process.php on line 19



我在另一个进程上使用了相同的功能,它工作正常。我对编程很陌生,有人可以帮助我吗?

先感谢您!
<?php
session_start();
$type = $_SESSION['sess_usertype'];
if(!isset($_SESSION['sess_user_id']) || $type!="1"){
header('Location: login.php?err=2');
}
include('db.php');

$data = $conn->prepare("UPDATE student INNER JOIN user ON student.student_nric=user.user_nric SET user_password = ?,
student_name = ?,
student_address = ?,
student_contactNo = ?,
student_fatherName = ?,
student_fatherContactNo = ?
student_motherName = ?,
student_motherContactNo = ?
WHERE student_nric = {$_SESSION['sess_user_id']}");

$data->bind_param('ssssssss',
$_POST['user_password'],
$_POST['student_name'],
$_POST['student_address'],
$_POST['student_contactNo'],
$_POST['student_fatherName'],
$_POST['student_fatherContactNo'],
$_POST['student_motherName'],
$_POST['student_motherContactNo']);


$data->execute();
$data->close();
header("Location: stud-dashboard.php");
?>

最佳答案

根据 MySQLi 文档页面 http://php.net/manual/en/mysqli.prepare.php它指出:

mysqli_prepare() returns a statement object or FALSE if an error occurred.



您的错误表明您正在尝试调用函数 bind_param()boolean (FALSE) 并且因此您的错误表明您的准备调用中存在错误。

我认为这是由于 student_fatherContactNo = ? 之后缺少逗号所致.

关于php - (PHP) fatal error : Call to a member function bind_param(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42068062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com