0
code works if it is fetch() with fetch_object() of the error
public function consulta($id) {
$mysqli = $this->conexao->getCon();
$sql = $mysqli->prepare("SELECT * FROM pessoa WHERE id_pessoa = ?");
$sql->bind_param("s", $id);
$sql->execute();
$sql->store_result();
//asim funciona
$sql->bind_result($id_pessoa, $nome, $nascimento, $naturalidade, $nacionalidade, $sexo, $altura, $tipo, $cpf, $rg, $alcunha, $cutis_id, $civil_id, $status_id, $pront, $carac, $att, $user_id);
$sql->fetch();
return $nome;
/* assim não funciona e aparece o erro
$obj = new Alvo();
$obj = $sql->fetch_object();
return $obj->nome;
*/
}
Did the answer solve your problem? Are there any questions pending? If the question is solved, consider accepting the answer. See more details at How and why to accept an answer?
– Rafael Tavares