Registration Issue.!

saqib389saqib389 BeginnerLink Clerk
i m unable to find it.. tat why it is happening... plz help me...
i want to stop multiple username like if "ABC" is already registered then another user cannot registered from "ABC"
i have written a code.. its looks fine but still.. its getting multiple registration..

//Check if username already exists... 
 $q2 = mysql_query("SELECT * FROM `users` WHERE `username` = '".$_POST['username']."'");
   $q3 = mysql_fetch_object($q2);
   
    if($q3->username == $_POST['username']) {
	die('<BR><BR>Sorry, but the username "'.$q3->username.'" is taken, please choose another.');
}

i m checking here.. but still its getting registration with existing username
please help me out.. how can i restrict the user

Comments

  • danielneridanielneri WP V.I.P. VPS - Virtual Prince of the Server
    why do it in such a complicated way?

    [PHP]
    $username = $_POST;
    $q = "SELECT username FROM users";
    $q2 = mysql_query($q);
    if($q2 == $username){

    print 'Sorry the username ' . $username . ' has already been taken.';

    }

    [/PHP]

    it should work...
    ban1.gif
Sign In or Register to comment.