This is how I would normally check for empty results: mysql_fetch_assoc
However, I am using PDO for a client and in this login function, I want to return some text or a number or boolean to say a row was found or not.
public function Login ($email,$password)
{
$sqlQuery="SELECT * FROM db_user WHERE email= '".$email."' AND password='".$password." '";
$statement = $this->_dbHandle->prepare($sqlQuery); // prepare a PDO statement
$statement -> execute();
$dataSet= [];
if(mysql_num_rows($statement) == 1){
echo 'login true';
} else {
echo 'login false';
}
$count = $statement->num_rows;insteadmysql_num_rowsCOUNT(*)statement instead. You can't use bothPDOandmysqlat the same time. Well you could but it would be silly...and also not in the way you are trying.mysql_num_rowsisn't PDO. You can't mix APIs like that. It should be$statement->numRows().