Betty_S Posted March 7, 2007 Share Posted March 7, 2007 Hi, I got this error massage: Duplicate entry '135' for key 1 SQL= INSERT INTO mos_comprofiler ( `id`,`user_id`,`approved`… VALUES ( '135','135','1','1','… It’s ok with me if ‘id’=’id_user’, How can I remove this “no-duplicate” constrict ion? Thanks. Link to comment https://forums.phpfreaks.com/topic/41623-how-can-i-remove-this-%E2%80%9Cno-duplicate%E2%80%9D-constrict-ion/ Share on other sites More sharing options...
obsidian Posted March 7, 2007 Share Posted March 7, 2007 It's not telling you that you can't have 'id = id_user', it's telling you that whichever column you have set as your PRIMARY KEY already has the value that you are trying to insert. So, I would hope your `id` column is your primary key. The error is telling you that you already have a record with the ID of 135, so you can't have it again. You either need to declare another value for the primary key, or if you are using an auto_increment value, you can simply leave that value off your arguments, and one will be generated for you. Link to comment https://forums.phpfreaks.com/topic/41623-how-can-i-remove-this-%E2%80%9Cno-duplicate%E2%80%9D-constrict-ion/#findComment-201681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.