0
I am not able to solve this error, I am more than 5 hours programming kkk, I missed something ?
here is my code(THIS IN COMMENT WHERE HE SAYS THAT IS THE MISTAKE)
I am doing validation to log in
Trying to get Property 'num_rows' of non-object in
<?php
//includes
class User extends Database{
public function getUser($username,$senha){
$obj = new conectar();
$conexao = $obj->conexao();
$sql = "SELECT * FROM usuarios WHERE email = '$username' AND senha = '$senha'";
$result = $this->connect()->query($sql);
//AQUI ESTA O ERROR
$numRows = $result->num_rows;
if ($numRows == 1) {
return true;
}
return false;
}
}
Try passing $result->num_rows straight into if: if ($result->num_rows == 1) instead of putting it into a variable; If that’s the case you can check what’s coming into it with a print_r. Just so you know if you’re passing any information.
– Paulo Felipe Martins
tried, and nothing,
– Vitor
I used the print_r, and it is passing the information
– Vitor