On Wed, Jun 27, 2001 at 10:24:13AM -0600, Brian Grayless wrote:
> Is anyone familiar with this MySQL error?
> "1062: Duplicate entry '127' for key 1"
The error means you are attempting to put a second record in with the
value of 127.
> I wrote a great bookmark management program that works fine, but everytime I
> insert bookmarks, I insert somewhere over 120 and I start getting this
> error, and it won't add them anymore. Any suggestions???
I have one idea. The column is probably a signed tinyint. tinyints have
a range of -128 to 127. When you try to put in anything over 127, the
value is out of range, and so apparently tries to reinsert it as 127.
You could change the column to an unsigned tinyint, which would give you
a range of 0 to 255. Or an unsigned smallint, which gives you a range
of 0 to 65,535. Just make sure the column is unsigned, since I doubt
you will be storing negative numbers in the column. This can be done
easily from the mysql client:
alter table your_table modify your_column smallint unsigned;
/* This bit of chicanery makes a unary function followed by
a parenthesis into a function with one argument, highest precedence. */
-- Larry Wall in toke.c from the perl source code
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]