SV: [PHP-DB] AUTO_INCREMENT
| From: | Knut Sætre | Date: | Sun, 04 Mar 2001 15:49:12 +0000 |
| Subject: | SV: [PHP-DB] AUTO_INCREMENT | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7111@lists.php.net to get a copy of this message | ||
change
CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL
AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id);
to
CREATE TABLE chatmessages (id int(11) DEFAULT '0' NOT NULL
AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id);
mvh
Knut
> -----Opprinnelig melding-----
> Fra: Joris Kluivers [mailto:joris@mac.com]
> Sendt: 4. mars 2001 12:59
> Til: php-db@lists.php.net
> Emne: [PHP-DB] AUTO_INCREMENT
>
>
> hi,
>
> 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
>
> Joris Kluivers