Jump to content

namasteji1

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

namasteji1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am getting a sql error, error in where clause for regname and also i would like to know where to put separate echo statements for duplicate username as well as username please?
  2. Many thanks for this, but this seems to check for any duplicate data i think? It's not specifically for duplicate email id ? I tried to add check for duplicate username by using your same code above and replacing email with username but , after registering the message appears of duplicate data again. Can you give code for checking duplicate username ?
  3. I have used them at the start of my code as you can see. So there's not a problem with that.
  4. Ok, i used mysql only and the same error is displaying.
  5. $q = "SELECT id FROM users WHERE email='$_POST[regemail]'"; $r = mysqli_query ($dbc, $q); // Line 39 if (mysqli_num_rows($r) == 0) { // Available. // Line 41 $sql="insert into users (name,email,mobile,password)values('$_POST[regname]','$_POST[regemail]','$_POST[regmobile]','$_POST[regpass1]')"; }else print "this email is taken"; $result=mysql_query($sql,$conn) or die(mysql_error()); print "<h1>you have registered sucessfully</h1>"; print "<a href='index.php'>go to login page</a>"; } else print "Passwords doesn't match"; } else print"Invalid input data"; ?> So i did changes as you told but i am getting the following message[/code]
  6. Can you please give an example, like checking for duplicate email address? Thanks
  7. <?php session_start();session_destroy(); session_start(); if($_POST["regname"] && $_POST["regemail"] && $_POST["regmobile"] && $_POST["regpass1"] && $_POST["regpass2"] ) { if($_POST["regpass1"]==$_POST["regpass2"]) { $servername="localhost"; $username="root"; $conn= mysql_connect($servername,$username)or die(mysql_error()); mysql_select_db("test",$conn); $sql="insert into users (name,email,mobile,password)values('$_POST[regname]','$_POST[regemail]','$_POST[regmobile]','$_POST[regpass1]')"; $result=mysql_query($sql,$conn) or die(mysql_error()); print "<h1>you have registered sucessfully</h1>"; print "<a href='index.php'>go to login page</a>"; } else print "Passwords doesn't match"; } else print"Invalid input data"; ?> I have email set as unique index in my table in database. I want to display error message for duplicate entries a user may make while registering. Please help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.