People, I'm not able to return the result of a search with prepared statement.
Here is the code:
public function search($obj) {
$connection = new Connection();
$this->db = $connection->conectar();
/* String SQL de buscar todos os registros */
$stringSQL = "SELECT * FROM fornecedor WHERE cnpj = :cnpj";
$statement = $this->db->prepare($stringSQL);
/* parâmetros do prepared statement */
$statement->bindparam(":cnpj", $obj->getCnpj());
/* executa a query */
$statement->execute();
$result = $statement->get_result();
unset($this->db);
return $result;
}
I have the following error:
Fatal error: Call to undefined method PDOStatement :: get_result () in C: \ xampp \ htdocs \ inove \ peoplelella-master \ production \ Classes \ Persistence \ ProviderCrud.php on line 123
Any help?
Thank you