1

Can someone tell me why this code is not updating the the column in these rows please

$q2 = $db->prepare("insert into stat (clan_id,abbreviation) values (:cid,:abb) ON DUPLICATE KEY UPDATE abbreviation=:abb");
            $q2->execute(array(
                ":cid"=>$somevalue,
                ":abb"=>$abbrev
                ));

abbreviation is my unique key in this table, there are more values but I removed some for clarity.

Edit: Problem still exists, the PDO is adding new entries, however when it comes across a duplicate it is not updating

here is the table structure, there maybe something wrong here?

CREATE TABLE IF NOT EXISTS `stats` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clan_id` varchar(168) NOT NULL,
  `abbreviation` varchar(64) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `abbreviation` (`abbreviation`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=155146 ;
Puddy
  • 11
  • 2

0 Answers0