0

Hello,

I am currently learning PHP. I am trying to implement a sign up page. The name at the same email address of the users in the database should give me an error message.

I don't know how to start with. I started this by searching the emails in the database and see if they exists already but then I am very confused.

Thanks

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by Stefano Mtangoo
0

suppose you have field in database called email and php form field named email then

$email = mysql_real_escape_string($_POST['email']);
$sql = "SELECT * FROM users_table WHERE email='$email'";
$res = mysql_query($sql)
if($res){
    if(mysql_num_rows($res)>0){
        //email found
    else{
        //email not found
    }
}else{
// nothing came from db perhaps errors or such
}
//code totally untested!
0

Thanks for your replies. I think I have found the solution to my problem.

If (entered_name) in page is equal as (name) in database && (email_entered) in page is equal as (email) in databse then show error message

else insert entered details in database.

Can I do that?

0

Thanks for your replies. I think I have found the solution to my problem.

If (entered_name) in page is equal as (name) in database && (email_entered) in page is equal as (email) in databse then show error message

else insert entered details in database.

Can I do that?

that is it! go ahead implement it and mark thread solved :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.