2017-02-06 2 views
2

몇 가지 이유가 있습니다.(PHP) 치명적인 오류 : 멤버 함수 bind_param()을 호출하십시오.

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

다른 프로세스에서 동일한 기능을 사용했지만 정상적으로 작동합니다. 나는 프로그래밍에 익숙하지 않다. 누가 도와 줄 수 있니?

미리 감사드립니다.

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

귀하의 오류는 당신의 오류가 있음을 알 수 있듯이 당신이 boolean (FALSE)의 기능 bind_param()를 호출하려고되고 있다고 말한다 :

<?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"); 
?> 
+0

누락 된',''student_fatherContactNo =? ' – Saty

+0

Omg, 미안 해요. 나는 정말로 그것을 알아 차리지 못했다. 감사. – Skyzoria

+0

또한,'$ _SESSION [ 'sess_user_id']'를 준비하는 것이 어떻습니까? – Qirel

답변

4

는 MySQLi 문서 페이지 http://php.net/manual/en/mysqli.prepare.php 당이 그것한다고 준비 호출에 오류가 있습니다.

나는 이것이 student_fatherContactNo = ? 뒤에 누락 된 쉼표로 인한 것임을 제안합니다.

+0

솔루션은 동일하지만 참조는 약간 떨어져 있습니다.'bind_param()'은 MySQLi 함수이며 PDO는 아닙니다. – Qirel

+0

죄송 합니다만, 나는 이것이 어떤 이유로 PDO라고 가정 했었습니다 ... 그에 따라 업데이트 할 것입니다. –

관련 문제