2

For some reason I'm getting.

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

I used the same function on the other process and it works fine. I'm pretty new to programming, can anyone help me?

Thank you in advance!

<?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");
?>
Qirel
  • 25,449
  • 7
  • 45
  • 62
Skyzoria
  • 31
  • 1
  • 3

1 Answers1

4

As per the MySQLi documentation page http://php.net/manual/en/mysqli.prepare.php it states that:

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

Your error says that you are trying to call the function bind_param() on a boolean (FALSE) and as such your error suggests that there is an error in your prepare call.

I would suggest that this is due to a missing comma after student_fatherContactNo = ?.

Peter Featherstone
  • 7,835
  • 4
  • 32
  • 64