Hello!
I have a page were users register with there nickname. I want the page to write out a nice little error msg when a nickname already is in the database.
Some code that search through the database and if it finds the nick the user tried to register with it writes something like: "Sorry that nick is already taken, try another."
How do I write it?
Thanks in advance!
Regards /Emil Hansson
Assuming a MySQL database, Php page, somethin like:
$query = "Select * from database where nickname = $SubmittedNickName";
$result =@ mysql_query($query);
if ( mysql_num_rows($result) ) { echo 'Sorry, this Nick is already taken'; }
assuming mySQL:
$result = mysql_query ("SELECT nickname FROM table WHERE nickname = '$nickname'"); if (mysql_num_rows ($result)) {echo 'The nickname you entered, ' . $nickname . ', is already taken';}
ah!!
Didn't think of that! Thank you very much for the help guys!
/Emil Hansson