Page 1 of 1

MySQL Insert Problems

Posted: Fri Feb 07, 2003 9:10 pm
by evilmonkey
Heelo. I'm using a MySQL db, and I have an auto_increment line called id, as well as a bunch of other columns (varchar, into, etc.)

The problem is, I went up to 127 rows (113 in actuality, 127 by the id numbers), and it refuses to add the 128th. It says:

Duplicate entry '127' for key '1'

I have no idea what that means, but i can't insert rows through my scripts, not through PHPmyADMIN. The max_rows is set to 10 000. What should I do?

Cheers!

Posted: Fri Feb 07, 2003 10:42 pm
by dstefani
Are you trying to insert a value into the auto_increment column?

If you are, then this is most likely your problem.

An insert into a table like this should start like:
insert into TABLENAME values(' ', col_2, col_3, etc...

The first insert value must be an empty value since the "auto" of the auto increment will do the rest.

I hope this helps.

Don

Posted: Sat Feb 08, 2003 3:18 pm
by evilmonkey
Nope, first value is always empty. Thanks for trying though. Any other suggestions?

Cheers!

Posted: Mon Feb 10, 2003 2:48 am
by twigletmac
It may be that you are using a TINYINT field to store the autoincrement value. If so then the problem is that a TINYINT field can only store values up to 127 - you probably just need to change your field to a SMALLINT or MEDIUMINT field, depending on how big it will need to be able to grow.

For more info:
http://www.mysql.com/doc/en/Numeric_types.html

Mac