> >'Duplicate entry 'username' for key 1.
This means that you do have a duplicate entry in a row of your DB. Try setting a
column as "Auto
increment": ALTER TABLE <table_name> id smallint(10) DEFAULT '0' NOT NULL
auto_increment (or
something like that) This means each set of data you put into the DB will
automatically create a
new row in which to insert this data.
You should really do some basic checking before you do inserts, to ensure you don't
have multiple
entries: $check = mysql_num_rows($query);
if($check != 0) {
echo "You have a duplicate entry!";
}
Cheers
Russ
On Mon, 17 Dec 2001 23:40:44 +0100 nautilis <[EMAIL PROTECTED]> wrote:
> Hi everybody!
>
> My problem is:
>
> I have a form to allow users in a website to register. My problem is that
> when someone registers a name that is alredy taken, mysql returns a
> 'Duplicate entry 'username' for key 1.
>
> I just want to show a message to user telling that the username is in use by
> another user and prompting him to choose a new one.
>
> I am a newbie at php and mysql so any help will be greatly appreciated.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
www.theruss.com
#-------------------------------------------------------#
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]