Senior Gamer Senior Gamer - 25 days ago 5x
PHP Question

Email already exists

Alright so for some reason, Im always getting that email already exists if it doesnt.

public function emailExists($mail) {
$handler = new sql();
$sql = $handler->connect();


$result = $sql->query("SELECT email FROM users WHERE email='".$mail."'");

if($result->num_rows != 0) return true;
else {
$handler->log_write($mail, "register_fail","NULL");
return false;
return false;

Now here is the check

if($user->emailExists() == false) {
$user->create($name, $pass, $email, $age, $gender);
jquery_alert("You have been registered. Thank you for using our services. Enjoy your stay!");
else {
jquery_alert("This email already exists");


Pass email address as argument in method.

if($user->emailExists($email) == false) {
// your code here