• 0

A mySQL DB question....


Question

Never mind....

But, anyone know how to fix this error:

Duplicate entry '1' for key 1

It happens when I try to run this query:

INSERT INTO ibf_categories (id, position, state, name, description) VALUES('1','1','1','General','');

Edited by OptiPlex
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

id is a primary key. you're trying to define another row with the id 1, when you have a row with that id already. primary key values have to be unique.

Make id auto_increment (assuming it's not already), then use this query:

INSERT INTO ibf_categories (position, state, name, description) VALUES('1','1','General','');

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.