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

标签 php

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

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/

相关文章:

php - ZF2没有 "vendor"文件夹

php - SELECT JOIN 在同一表中多行

php - 解码用 'zend guard' 编码的 PHP

php - 如何将静态页面添加到 WordPress?

php - 使用 URL 到 API Rest 的日期过滤器 - Codeigniter

php - Sendhub API 问题

php - 从 Mysql/PHP 中的字符串中删除最后 7 个字符

php - 通过相同 id 通过其他表中的其他行的值更新表的行

php - 生成随机 5 个字符的字符串

php - date now() 和 MySQL 表内日期的区别