Hello,
This is what I did:
$username_check = "SELECT * FROM tablename WHERE username = '$userid'";
$usernameresult = mysql_query($usernamecheck);
$numberrows = mysql_num_rows($usernameresult);
if ($numberrows != "0") {
echo "That username already exsists, please choose another.";
}else{
INSERT INTO....
}
that should work. It worked for me.