I have function for getting the user data from database
function getUser($usernameOrEmail) {
global $db;
$stm = $db->prepare("SELECT * FROM users WHERE username = :userData OR email = :userData");
$stm->execute([ ":userData" => $usernameOrEmail ]);
$row = $stm->fetchAll(PDO::FETCH_ASSOC);
return ($row != null) ? $row[0] : false;
}
The problem is when I pass username with spaces in it, for example "John Doe" then I am always getting "false" as a result even if I have record with that username in database. But if I try just to pass for example "John" and I have that record in db also, everything is fine... What am I doing wrong?