Jump to content

How can I remove this “no-duplicate” constrict ion?


Betty_S

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.