Monday, 20 July 2015

To check whether an email id exists or not in database using PHP

This post is used to check  whether an email id exists or not in database using PHP. If the email id already exist an alert message will be shown below. And if the Email Id is not available in the database then  it will automatically store in the database. This concept is designed using if  else statement and method to fetch and check number of rows in the database.

Create sample database table and email field design the post value form using below coding. To check on mysql_num_rows($search_num); this query search database stored email id in select to the field rows. 

<?php
if(isset($_POST['submit'])!="")
 {
 $eamil1=$_POST['email'];
 $search_num=mysql_query("select * from signup  where email='$eamil1'");
 if(mysql_num_rows($search_num)>0)
 {
    echo "Already exist this email id";
 }
 else
 {
         
    header("Location:Register-Free.php");
 }
 }
?>

0 comments:

Post a Comment