0
Guys, I’m not getting back the result of a search with Prepared statement.
Here’s 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’m making the following mistake:
Fatal error: Call to Undefined method Pdostatement::get_result() in C: xampp htdocs inove gentelella-master Production Classes Persistence Vendordorcrud.php on line 123
Some help?
Thank you
Is mixing PDO with a Mysqli function...
– Inkeliz
@Inkeliz thank you. It’s true.
– Gabriel Augusto