The problem is with the TINYINT data type in your table. Check here: http://dev.mysql.com/doc/refman/5.0/en/ ... types.html . Notice that the maximum value for signed TINYINT is 127. To fix this, edit the table structure, and change the ID field's type to SMALLINT or MEDIUMINT. You could also specify it to be UNSIGNED, so you're not potentially wasting half the range.mfandel wrote: The insert is failing because the ID value has to be unique and by default every query your form generates uses the same key value (127). Since there is already an entry in the database with the same value, MySQL refuses to overwrite it.
I don't really see why the form itself would be using the same key value... I can't find any mention of ID in the script!
Also, that section of the MySQL manual says:
So you probably want to add the ID field in your query, just set it's value to NULL.http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html wrote:Integer or floating-point data types can have the additional attribute AUTO_INCREMENT. When you insert a value of NULL (recommended) or 0 into an indexed AUTO_INCREMENT column, the column is set to the next sequence value.