any one know how to do this

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    any one know how to do this

    does any one know how to let an email addy only reg with one username
    like you cant reg the same username 2 times lol i been trying to do it but got no where

    #2
    Originally posted by jsyguy23 View Post
    does any one know how to let an email addy only reg with one username
    like you cant reg the same username 2 times lol i been trying to do it but got no where
    PHP Code:
    $usercheck="SELECT*from users where username='$username' or email='$email'";
      
    $usercheck2=mysql_query($usercheck);
      while (
    $usercheck3=mysql_fetch_array($usercheck2))
      {
        
    $valid=0;
      }
      if(
    $valid==0)
      {
        print 
    "That username has been taken or there is already someone registered with that email, please <A href='register.php'>Try to register again</a>.";
      } 

    Comment


      #3
      better way would be to create a unique key on the email or username field then when u try and dupe a user it wont work, then its just a case of using a bit of code to grab the error number, and if the error code is 1062 (i think would have to check) then its a dupe entry and you can display error accordingly

      simply removes the need for that code block, makes the code nicer, allows for multiple things to be checked in one go using error codes and correct setup of tables and more importantly reduces number of queries

      Comment

      Working...
      X