I had this same problem man- here is how I did it-
run an if statement that checks to see if the username exists, if it does, then redirect them to an error page, or print a statement staing that the username is in use.
Here is an example-
Connect to database
##Select statement:
"SELECT * from TableName where uname = 'enter variable such as $veriuser'";
get the results into an array and assign the variables appropriately.
if ($veriuser == "$uname") {
Print ("I am sorry that username is in use, please us e your browsers back button to try again");
exit;
}
else {
your other staments here}
I hope I explained that well enough, if not let me know