The query is executing normally for a successful database search, but for an unsuccessful search it is still following the successful execution path. Is there a different way to analyze $result for an unsuccessful Mysql database query?
$query = "SELECT password
FROM consumer
WHERE username = ? ";
//prepare query
if ($stmt = $this->conn->prepare($query)) {
$stmt->bind_param('s', $username);
$stmt->execute();
$result = $stmt->get_result();
if (!is_null($result) && empty($stmt->last_error) && count($result)>0) {
//successful query, going to this every time even when there
//is no row in the database that matches the query
} else {
//unsuccessful query
}