mysqli prepared expect parameter?

后端 未结 1 1962
梦毁少年i
梦毁少年i 2021-01-29 05:38

I try to write own database class.I have some problem.

When I run it , it gives these errors.

Warning: mysqli_stmt_bind_param() expects parameter 1 to be         


        
相关标签:
1条回答
  • 2021-01-29 05:58

    Anytime you see "boolean given" in a mysql error message, it means that some previous mysql function call has failed, returning a boolean FALSE value. You're trying to use that boolean false in the current mysql call, and get this message.

    You have no error handling in your code, which means those FALSE values will propagate throughout your code, spitting out those errors everywhere it goes.

    At minimum, your code should look something like this, everywhere you do a mysql/mysqli call:

    function see(){
        $id = 'select * from uyeler where id=?';
        $sor = mysqli_prepare($this->durum, $id);
        if ($sor === FALSE) {
            die(mysqli_error($this->durm));
        }
        etc...
    }
    

    How you handle the error is up to you - in this case it'll simply abort the script and tell you why.

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