![]() |
Mysql error
Hi!
What's causing this error? :S Quote:
|
What field type and size is your primary key?
|
Since you seem to expect image_id to increment from submitting a null value, I assume auto_increment was specified for image_id.
my guess is the same as where i think etoolbox was going. Use a larger int (guessing image_id is tinyint) small int/medium int/int (i'd prolly recommend Int). |
Without knowing the type like etoolbox said it's kind of hard.
If it is a primary key, it is not safe to leave it a null, so the record is not created. That could be the reason. If the image_id is set to auto_increment, you don't need to make an explicit insert with that field, something like this would work: Code:
INSERT INTO images(image_productid, image_src, image_front)Code:
INSERT INTO images(image_id, image_productid, image_src, image_front) |
My guess is it's a tinyint with a max integer value of 127. You cannot insert a value > 127 into this field. What MySQL "helpfully" does is to try to make it the highest value if it's not specified and because that key already exists you get a "duplicate entry" error when in fact that's not the real error, it's that you have an overflow on the PK.
|
Quote:
|
Wow, alot of replies :-)
Quote:
Quote:
You're good at guessing ;-) Thanks! I'll try changing it Quote:
Quote:
Quote:
|
Great, Let us know how you fix it then ;)
|
Quote:
|
Good! I tend to forget about the sizes of the numeric fields too.
|
I certainly did that now xDD But luckily talkphp exists ^^ :-)
|
| All times are GMT. The time now is 06:20 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0