Need an extra set of eyes - I have the following database tables:
id - Primary, Auto-Increment
user_id - Unique
Query:
$db->executeQuery("
INSERT INTO unsubcontact
(user_id,date_added)
VALUES
(:userId,:dateAdded)
ON DUPLICATE KEY UPDATE
date_added = :dateAdded
");
Gets this error:
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'UNIQ_xxxx
And '1' is the userId / unique key.
Why isn't the row being updated opposed to generating this error?