> I'm trying to build a log-in feature for my site. At the moment, users
> can log in and create accounts.
>
> The way I've got it set up is that the users table has the "username"
> column as the primary key to make sure that a username remains unique.
>
> However, when users are registering, how do I return a message that
> says "That user name is already taken"? Right now it just stops
> processing and prints "Duplicate key". Most people are going to be
> confused by that.

$res=mysql_query("select * from accounts where username like 
'$wantedusername'");
if (mysql_num_rows($res)>0)
  myError('Sorry, username already in use. Try another one!');
else
  mysql_query("insert into accounts ..." 



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to