Jump to content

Archived

This topic is now archived and is closed to further replies.

witham

php error message

Recommended Posts

can anyone help please i have a database that i want to allow users to add products but i keep getting an error message "duplicate entry '127' for key 1"
I have no idea what this means?

thanks

Share this post


Link to post
Share on other sites
It sounds like you are trying to insert a record into the database and manually requesting the primary key 127 everytime.  This will not work.  For future reference, please post code snippets when you have issues.

Share this post


Link to post
Share on other sites
try using auto incriment in your table, and not inserting a product id in your php script.

also if you post the code, it would help too :-)

-Chris

Share this post


Link to post
Share on other sites
You may also be using a tiny int, and trying to make row 128.  Tinyint only supports -127 through 127.  

Code would have helped. :)

Share this post


Link to post
Share on other sites
ChaosXero "great call" been messing with this ages and never did I think for one minute that it was the tinyint.
Thanks very much I can stop messing with the sql insert code now!

Share this post


Link to post
Share on other sites
I've done it myself, so I know how frustrating those pesky types can be. I know how you feel, I always suspect the code first, and end up finding I've made some database mistake... They dont make SQL idiot proof enough for sloppy types like me. :)

Happy Coding

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.