我已完成代码,但由于某种原因,它不会更新数据。它只是再次添加它。
以下是代码:
$update = $pdo->prepare("INSERT INTO `users` (`name`, `steamid`) VALUES (:name, :steamid) ON DUPLICATE KEY UPDATE name = VALUES(name), steamid=VALUES(steamid)");
$update->bindParam(':name', $userJSON['response']['players']['0']['personaname']);
$update->bindParam(':steamid', $steamid, PDO::PARAM_STR);
$update->execute();