2
how can I use the mysqli->prepare
with the bind_param
I am trying to log in using these two functions but I can think of the following error
Only variables should be passed by reference
mysqli_num_rows() expects parameter 1 to be mysqli_result, object given
my code
$sql = parent::conectar()->prepare("SELECT id FROM admin WHERE email = ? AND senha = ?");
$sql->bind_param('ss',$this->getEmail(),$this->getSenha());
$sql->execute();
parent::desconectar();
if(mysqli_num_rows($sql) > 0){
$aux = $sql->fetch_object();
$_SESSION['idAdmin'] = $aux->id;
$_SESSION['logadoAdmin'] = true;
return true;
}else{
return false;
}