Alrite so i am trying insert new values into my table, and when i try to, i get the following error

#1062 - Duplicate entry 'Hit Em High' for key 'team_home'

Any idea how to fix this? I've heard it could be a primary key error, but im not sure.

Thanks!

Recommended Answers

All 2 Replies

You don't provide much info so all we can do is speculate. You should echo your insert statements. For the one that is getting an error, check the key against what is already in the table and you will probably find that there is already a record with that key in the table. How to handle it is up to you. How did the situation happen? Did you run the update process twice in a row or do you possibly have a duplicate in the input? If you find the record is already in the table, do you want to replace it, skip the insert and try the next one or give up? The decision is your's based on your needs.

Member Avatar for rajarajan2017

If you entering same values again to a primary key field then it wouldn't allow you to insert the records with duplicates. If you want duplicate then remove the primay key in your sql editor to alter the structure of the table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.