I had the following errors:
Notice: Only variables should be passed by reference in /var/www/html/crud/banco/Banco.php on line 30
Notice: Only variables should be passed by reference in /var/www/html/crud/banco/Banco.php on line 31
Notice: Only variables should be passed by reference in /var/www/html/crud/banco/Banco.php on line 32
Notice: Only variables should be passed by reference in /var/www/html/crud/banco/Banco.php on line 33
And I have the following code, can someone give me a light, can not do it like this?
public function insert($table, Post $post){
if(empty($table) == false){
$this->stm = $this->pdo->prepare("insert into ".$table." (titulo, data_criado, corpo, autor) values(?, ?, ?, ?)");
$this->stm->bindParam(1, $post->getTitulo());
$this->stm->bindParam(2, $post->getData_criacao());
$this->stm->bindParam(3, $post->getCorpo());
$this->stm->bindParam(4, $post->getAutor());
$this->stm->execute();
}
}