mysql排序 latin_mysql-如何解决排序规则的非法混合(latin1_ge...

我正在尝试更新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

我该如何解决这个问题?

谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值