2017-02-06 18 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をドキュメントページhttp://php.net/manual/en/mysqli.prepare.php 1として

<?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

それはと述べている:あなたのエラーはあなたがboolean(FALSE)に機能bind_param()を呼び出すようにしようとしていると言うと、そのようなあなたの誤差があることを示唆しているよう

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

準備呼び出しにエラーがあります。

これは、student_fatherContactNo = ?の後にカンマがないためです。

+0

解決策は同じですが、あなたの参照はちょっとだけです。 'bind_param()'はMySQLiの関数であり、PDOの関数ではありません。 – Qirel

+0

申し訳ありませんが、私はこれが何らかの理由でPDOであると思っていました...それに応じて更新します –

関連する問題