Jump to content


Photo

php error message


  • Please log in to reply
7 replies to this topic

#1 witham

witham
  • Members
  • PipPipPip
  • Advanced Member
  • 86 posts

Posted 18 July 2006 - 07:39 PM

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

#2 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 18 July 2006 - 07:44 PM

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.
Zend Certified Engineer (ZEND001989)
www.willfitch.com

#3 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 18 July 2006 - 07:45 PM

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

#4 ChaosXero

ChaosXero
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 18 July 2006 - 07:46 PM

You may also be using a tiny int, and trying to make row 128.  Tinyint only supports -127 through 127.  

Code would have helped. :)

#5 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 18 July 2006 - 07:47 PM

Very good analysis ChaosXero!
Zend Certified Engineer (ZEND001989)
www.willfitch.com

#6 witham

witham
  • Members
  • PipPipPip
  • Advanced Member
  • 86 posts

Posted 18 July 2006 - 08:00 PM

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!

#7 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 18 July 2006 - 08:03 PM

yeah good one ChaosXero

#8 ChaosXero

ChaosXero
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 18 July 2006 - 08:05 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users