Eggzorcist Posted August 17, 2009 Share Posted August 17, 2009 I'm not sure why I am getting this error, it was working before the first entry I put in... error mesasge. Duplicate entry '0' for key 1 Quote Link to comment https://forums.phpfreaks.com/topic/170752-solved-sql-error-involving-duplication/ Share on other sites More sharing options...
Eggzorcist Posted August 17, 2009 Author Share Posted August 17, 2009 Is this perhaps because I put the ID field as the key auto increment? Quote Link to comment https://forums.phpfreaks.com/topic/170752-solved-sql-error-involving-duplication/#findComment-900526 Share on other sites More sharing options...
roopurt18 Posted August 17, 2009 Share Posted August 17, 2009 Primary keys must be non-null and unique. So if you defiend ID as a primary key auto-increment field and you place a row with ID=0 in the table, you can not place another row with ID=0 in the table. Instead you must use a form of UPDATE: UPDATE `thetable` set ... WHERE ID=0 Quote Link to comment https://forums.phpfreaks.com/topic/170752-solved-sql-error-involving-duplication/#findComment-900529 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.