Checking if usename exists.. SELECT username FROm..
Posted: Sat May 10, 2003 1:06 pm
I am making a sign up form, I want to check if the username exists already, how can I? I pasted a PART of the script below, $name_check retuns a resource ID.. name of table is users, name of field to check is username.
Code: Select all
if(!get_magic_quotes_gpc())
{
$_POSTї'username'] = addslashes($_POSTї'username']);
print $_POSTї'username'];
}
mysql_connect('localhost') or die(mysql_error());
mysql_select_db('SignupTest') or die(mysql_error());
#$name_check = mysql_query("SELECT username FROM users WHERE username = '".$_POSTї'username']."'");
$name_check = mysql_query("SELECT username FROM users WHERE username='scr0p'") or die(mysql_error());
print $name_check;