我正在尝试更新MySQL表中的记录,但遇到以下错误.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (latin1_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=''
这是我的查询
$db->processQuery('UPDATE account_mids SET price_sheet_file = ? WHERE mid = ? AND price_sheet_file IS NULL', array($filename, $mid));
我试图添加整理,但是没有用.这就是我所做的
$db->processQuery('UPDATE account_mids SET price_sheet_file = ? COLLATE utf8_general_ci WHERE mid = ? COLLATE latin1_general_ci AND price_sheet_file IS NULL', array($filename, $mid));
但我收到以下错误
Syntax error or access violation: 1253 COLLATION 'latin1_general_ci' is not valid for CHARACTER SET 'utf8''
这是我的表演制作表
CREATE TABLE `account_mids` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`program_name` varchar(60) DEFAULT NULL,
`mid` char(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`stage` enum('Engaged','Pricing','Application Sent','Application Incomplete','No Sale','Pending Admin Approval','Admin Rejected','Admin Approved','Submit to PTC','Waiting PTC Decision','Approved','Declined','On Hold','Withdrawn','Cancelled','Change of Program') NOT NULL,
`type` enum('Existing Business','New Business','New Prospect','Change of Ownership','Program Transfer') NOT NULL,
`chapter_name` varchar(80) DEFAULT NULL,
`account_id` int(11) unsigned NOT NULL,
`agent_code` varchar(8) DEFAULT NULL COMMENT 'the 10th and 11th char in mid value plus 00 it will equal out 4 chars',
`prin_code` varchar(8) DEFAULT NULL COMMENT 'the 7th 8th and 9th char in the mid plus 0 on the right which is equal to 4 chars',
`price_sheet_file` varchar(30) DEFAULT NULL,
`created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` tinyint(1) NOT NULL DEFAULT '1',
`closed_reason` varchar(1000) DEFAULT NULL,
`closed_on` datetime DEFAULT NULL,
`approved_on` datetime DEFAULT NULL,
`enrolled_on` date DEFAULT NULL,
`training_requested_on` datetime DEFAULT NULL,
`first_sale_on` datetime DEFAULT NULL,
`speciality` varchar(255) DEFAULT NULL,
`created_by` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `mid` (`mid`),
KEY `account_id` (`account_id`,`status`),
CONSTRAINT `am_account_id` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=384010 DEFAULT CHARSET=utf8
我该如何解决这个问题?
谢谢