how to check data already exist in database in php & email already exist validation in php

how to check data already exist in database in php best 2 Ways To Check if Email already exists Using PHP Example and demo with To check if email already exists in database using PHP.

how to check data already exist in database in php

how to check email already exist in database in php To check if a particular value exists in the database, all you required to do is run a SELECT query.

how to check if an email address already exists in the database in php?

Set Email Column as UNIQUE on the Database


Email:


Don’t Miss : How To Check Email Already Exist In Database In Php

Validate Email using MySQL SELECT query with WHERE clause

 0){
    $email_error = "Sorry... member email already taken";  
  }else{
    $query = mysqli_query($link, "INSERT INTO `members`(`email`) VALUES('$email')");
    echo 'Saved!';
  }
}

How To Check If A Record Exists In A MySQL Database?

$query = "SELECT * FROM members WHERE mcode = '$mcode'";
$result = mysql_query($query);
if ($result) {
  if (mysql_num_rows($result) > 0) {
    echo 'found!';
  } else {
    echo 'not found';
  }
} else {
  echo 'Error: '.mysql_error();
}

Best way to test if a row exists in a MySQL table

mysql> SELECT EXISTS(SELECT * from members WHERE memberID=5623);

//AND

mysql> SELECT EXISTS(SELECT * from members WHERE memberID=5658);

I hope you get an idea about how to check data already exist in database in php.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment