Call to a member function bind_param() on a non-object (unable to solve despite research)

后端 未结 3 1580
忘掉有多难
忘掉有多难 2020-12-06 20:46
$stmt = $mysqli->prepare(\'select Un from member where Lock = ? and Activated = ?\');
$stmt -> bind_param(\"ss\", \'N\', \'Y\');//This line gave the error
$stm         


        
相关标签:
3条回答
  • 2020-12-06 20:56

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

    Source.

    $mysqli->prepare() may be returning FALSE. Write a condition to deal with that situation.

    0 讨论(0)
  • 2020-12-06 21:09

    Call to a member function bind_param() on a non-object means that $stmt, which you're trying to call bind_param on, is not an object. Why is it not an object? Because $mysqli->prepare did not return an object. Why did it not return an object?

    mysqli_prepare() returns a statement object or FALSE if an error occurred.
    http://www.php.net/manual/en/mysqli.prepare.php

    So that means an error must have occurred. You should turn on error_reporting, which will probably tell you, or examine $mysqli->error(), which may tell you as well.

    0 讨论(0)
  • 2020-12-06 21:12
    $stmt->bind_param("ss", 'N', 'Y');//This line gave the error 
    

    Here you need to sure about data type in database.

    0 讨论(0)
提交回复
热议问题