When trying to insert something into the bank with boolen error mysqli

Asked

Viewed 205 times

0

Shows this error:

Uncaught Error: Call to a member function bind_param() on boolean in /opt/lampp/htdocs/sala/class/Config.class.php:35

In my file it’s like this:

public function Cadastrar(string $nick,string $senha,string $status, int $online_status) {
            $this->Query = $this->Conexao->prepare("INSERT INTO usuarios (nick,senha,sexo,status,online_status) VALUES (?,?,?,?)");
            $this->Query->bind_param("sssi",$nick,$senha,$status,$online_status);
            $this->Query->execute();
            return "Registrado com sucesso!";
        }
  • 1

    One of the problems is that there are 5 columns (nick [1] ,senha [2] ,sexo [3] ,status [4],online_status[5]), but there are only 4 values (? [1],? [2] ,? [3] ,? [4]). This is one of the mistakes, maybe there are others.

  • i took the sex and keeps giving error, now the number of columns is all right, I can insert it well if I am going to do it in the same class file, but when using require or include to instantiate the class, ai gives that error

  • Oops, you’re right, now that I realized I took out the sex variable I had but I ended up leaving sex in the same column, vlw man

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.