I would use my username when the username is the second condition but the email wouldn't work and then vise versa. This is my code below all help is appreciated. :)
public function loginUser($usernameEmail,$password){
$query = $this->db->prepare("SELECT * FROM users WHERE email OR username = :usernameEmail");
$query->execute(array(":usernameEmail"=>$usernameEmail));
$rows = $query->fetch(PDO::FETCH_ASSOC);
if(password_verify($password, $rows['password'])){
$_SESSION['userID'] = $rows['userID'];
$_SESSION['username'] = $rows['username'];
$_SESSION['usergroup'] = $rows['usergroup'];
return true;
} else {
return false;
}
}