我有一张表,我想根据 2 列替换数据。
我的查询目前如下所示:
$query = "REPLACE INTO `".$database."`.`".$table_extras."` (`id`, `multiverseid`, `rulings`, `printings`, `foreignNames`) ";
$query .= "VALUES (".$cardCount.",
".$multiverseid.",
'".addslashes($rulings)."',
'".addslashes($printings)."',
'".addslashes($foreignNames)."');";
目前使用上述查询的东西会根据“id”被替换。我怎样才能使它基于“id”和“multiverseid”进行替换?
当我创建我的表时,它如下所示:
CREATE TABLE IF NOT EXISTS `extras` (
`id` int(10) unsigned NOT NULL,
`multiverseid` int(10) unsigned NOT NULL,
`number` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`rulings` text COLLATE utf8_unicode_ci NOT NULL,
`printings` text COLLATE utf8_unicode_ci NOT NULL,
`foreignNames` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`, `number`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;