witham Posted July 18, 2006 Share Posted July 18, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/ Share on other sites More sharing options...
willfitch Posted July 18, 2006 Share Posted July 18, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60082 Share on other sites More sharing options...
cmgmyr Posted July 18, 2006 Share Posted July 18, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60083 Share on other sites More sharing options...
ChaosXero Posted July 18, 2006 Share Posted July 18, 2006 You may also be using a tiny int, and trying to make row 128. Tinyint only supports -127 through 127. Code would have helped. :) Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60084 Share on other sites More sharing options...
willfitch Posted July 18, 2006 Share Posted July 18, 2006 Very good analysis ChaosXero! Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60087 Share on other sites More sharing options...
witham Posted July 18, 2006 Author Share Posted July 18, 2006 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! Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60105 Share on other sites More sharing options...
cmgmyr Posted July 18, 2006 Share Posted July 18, 2006 yeah good one ChaosXero Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60109 Share on other sites More sharing options...
ChaosXero Posted July 18, 2006 Share Posted July 18, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/14964-php-error-message/#findComment-60111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.