PHP register check for user in database [closed]
PHP register check for user in database [closed] I created a function that checks for user in database but when I type the email that exists, it returns the message, and then, on second try can't proceed to register function, can't get rid of error, here is my try: if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $email_error = "Invalid email format"; } else if($user->doesUserExist($email) > 0) { $email_error = "Email is already taken"; } else { $email_error = ""; } if(empty($error) && empty($email_error) && empty($confirm_password_error)) { $user->register($username, $name, $email, $password); } It's not problem with register function. Here are the class functions: public function doesUserExist($email) { $query = "SELECT count(*) FROM users WHERE email = :email"; $stmt = $this->connection->prepare($query); $stmt...