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 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? 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 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
Archived
This topic is now archived and is closed to further replies.