I need to check a username against those in a mysql database, to see if it is the same as any others, and if so, die.
What queries and php do I need to write?
Moderator: General Moderators
Code: Select all
$query = "SELECT COUNT(*) as `tot` FROM `table` WHERE `username`='$username'";
$result = mysql_query($query) or die(mysql_error());
if (mysql_result($result,0,'tot') != 0) {
//die
}