PHP Code:
<?
$username="trevor";
$result=mysql_query("select * from users where username='$username'");
$num=mysql_numrows($result);
if($num > 0) {
echo "sorry, that username already exists.";
}
else {
// do registration here
}
?>
that query should not be case sensitive .. so if it returns any more than 0 results, .. there is a 'Trevor' or 'trevor' already existing in your system.