I'm pretty sure $existing = $stmt->fetchObject();
is fetching you an empty object, but one that does not implicitly evaluate to false
. After that there's nothing in your code that would trigger, leading to your blank output.
Try a var_dump($existing)
to see what your code is actually operating on.
edit
$existing = $stmt->fetchObject(); //this might be returning an empty object
if ($existing) { //empty objects evaluate to true
if ($existing->username == $_POST['username']) {
$errors['username'] = "Username already in use !";
} else if ($existing->email == $email) {
$errors['email'] = "Mail already in use !";
} else {
//this will trigger if something ELSE is wrong other than what you're explicitly checking for.
$errors['other'] = "Something else is wrong.\n" . var_export($existing, TRUE);
}
}