Page 2 of 2

Re: Send to MYSQL Database

Posted: Mon Apr 05, 2010 1:54 pm
by minorDemocritus
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.
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.

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:
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.
So you probably want to add the ID field in your query, just set it's value to NULL.

Re: Send to MYSQL Database

Posted: Mon Apr 05, 2010 2:51 pm
by mfandel
That was it!
You all are the best!
It was simply that tinyint...WHOOHOOO.
Though took a long round about to get there I learned a lot!
Thanks again

Re: Send to MYSQL Database

Posted: Mon Apr 05, 2010 2:58 pm
by minorDemocritus
Glad to hear it. It'd be nice if you edited your first post to add SOLVED to the title.

Re: Send to MYSQL Database

Posted: Mon Apr 05, 2010 8:01 pm
by lunarnet76
in case tinyint(100) does not mean anything more than tinyint(3) as the number cannot be more than 127 !

Re: Send to MYSQL Database

Posted: Tue Apr 06, 2010 3:19 am
by minorDemocritus
lunarnet76 wrote:in case tinyint(100) does not mean anything more than tinyint(3) as the number cannot be more than 127 !
Right. The "length" of an INT or FLOAT field is merely the display width: it governs how many spaces MySQL will pad the output when it is retrieved from the DB.