Fatal Error: Uncaught Error: Call to a Member Function bind_param() on bool

Asked

Viewed 15 times

0

I am preparing the following method of uploading information:

public function uploadProjeto(int $idCategoria, string $titulo, string $area, string $ano, string $endereco, string $descricao){

       
        

        $insertProject = $this->mysql->prepare("INSERT INTO tbprojetos (id_categoria, titulo, area, ano, endereco, descricao) VALUES ('?, ?, ?, ?, ?, ?, ?')");
        $insertProject->bind_param('isssss', $idCategoria, $titulo, $area, $ano, $endereco, $descricao);
        $insertProject->execute();
    
    
    }

  • Your question could have more information. What and $this->mysql.

  • the sql string should not have those simple quotes inside the values, so try VALUES (?, ?, ?, ?, ?, ?). Besides, it’s six parameters, there’s an extra "?" there

  • Oh yes, $this->mysql is to make the connection to Db given the parameter of the class constructor, which would be 
class Projeto {
 private $mysql;

 public function __construct(mysqli $mysql){
 $this->mysql = $mysql;
 }


No answers

Browser other questions tagged

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