I'm trying to do MySQL query with update on duplicate key but I can't see whats wrong with syntax because getting "syntax error or access violation" error.
code:
$sql = "INSERT INTO site_configuration
(configuration_key, configuration_value, additional_data)
VALUES
(:config_key, :site_new_background, :site_background_meta)
ON DUPLICATE KEY UPDATE
'configuration_value' = VALUES(:site_new_background), 'additional_data' = VALUES(:site_background_meta)";
$smth = $database->prepare($sql);
$smth->bindParam(':config_key', $config_key, PDO::PARAM_STR);
$smth->bindParam(':site_new_background', $site_new_background, PDO::PARAM_STR);
$smth->bindParam(':site_background_meta', $site_background_meta, PDO::PARAM_STR);
Error message:
'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''configuration_value' = VALUES(?), 'additional_data' = VALUES(?)'