Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Query does wrong thigs

I am trying to execute this siple query:

  • $update = $this->modelsManager->executeQuery("UPDATE Country SET active = '1' WHERE cc_fips = '$enteredcountry'");

But i get thiss error:

  • SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'FI' for key 'cc_fips'

I have logged the query , and it is this one :

  • INSERT INTO country (cc_fips, cc_iso, tld, country_name, active) VALUES (?, ?, ?, ?,

Why is it inserting a new record instead of updating the selected one?


Are you sure you are logging the correct query? Because it doesn't seem so.


I have had en error in my database : my unique value vas set to accept zero values. Whatever.... I have lost 3 days on this issue... I'm totally frustrated :D

UPDATE Country SET = '1' WHERE Country.cc_fips = '$enteredcountry'