At 12:58 PM 3/4/01 +0100, Joris Kluivers wrote:
>i have a problem
>i have a database table created with the statement:
>CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL
AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id);
>I insert records with:
>INSERT INTO chatmessages (message, username) VALUES ('$message', '$username')
>this works fine (for a while), i can insert messages and retreive them
with php.
>But after some time i get the error:
>ERROR 1062: Duplicate entry '127' for key 1
>but how can this be because i've set it to AUTO_INCREMENT.
>can someone help me?
>thanks in advance

Don't use tinyint.  It only allows 128 values (0 to 127).  Any values
larger than 127 will go in as 127.

Try smallint or int.    Sounds like phpadmin, it defaults variables as

"To dwell within Samsara, however, is to
 be subject to the works of those mighty
 among dreamers."

 - Mahasamatman, in Zelazny's "Lord of Light"

Andrew Apold

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to