use laserlight's suggestion to force uniqueness in the database
before you register someone, check the username isn't already taken with a query something like this (w/ your own table and var names of course):
$sql = "select * from user_table where username like '" .
mysql_real_escape_string($username) . "'";
$res =mysql_query($sql);
if(mysql_num_rows($res) > 0) {
// user name already taken
}
if you define the username column in the table w/ unique index constraint, it will help look up efficiency too:
constraint unique index(username)