Senior Gamer Senior Gamer - 1 year ago 172
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");

Answer Source

Pass email address as argument in method.

if($user->emailExists($email) == false) {
// your code here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download