我正在使用 PDO 来处理(MYSQL)数据库。当我保存结果时,这个 SQL 没有更新列值,它会用新的保存值创建一个新行。我犯了什么错误。有没有人可以帮助我用 PDO 理解这种行为
$SQL =<<<'EOD'
CREATE TABLE IF NOT EXISTS pard_admin_config(
title varchar(255) NOT NULL,
online varchar(100),
offline varchar(100),
email varchar(100),
metades varchar(200),
metakey varchar(200),
copyright varchar(200),
pard_host varchar(100),
pard_database varchar(100),
username varchar(100),
password varchar(100)
)
EOD;
$pardConfig->query($SQL);
$stmt = $pardConfig->prepare("INSERT INTO pard_admin_config (title, online, offline, email, metades, metakey, copyright, pard_host, pard_database, username, password) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
title='?', online='?', offline='?', email='?', metades='?', metakey='?', copyright='?', pard_host='?', pard_database='?', username='?', password='?'");
$ConfigData = array($adminConfig->TITLE,
$adminConfig->ONLINE,
$adminConfig->OFFLINE,
$adminConfig->EMAIL,
$adminConfig->METADESCRIPTION,
$adminConfig->METAKEYWORDS,
$adminConfig->COPYRIGHT,
$adminConfig->HOST,
$adminConfig->DATABASE,
$adminConfig->USERNAME,
$adminConfig->PASSWORD);
$stmt->execute($ConfigData);