首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB

2012-08-22 
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB我的php文件设置的是

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB
我的php文件设置的是utf8的,数据库连接过程也都是utf8。数据库用的校对编码及字符编码是utf8_unicode_ci。但是我在执行查询句 $sql = "select * from commodity where commodity_name like '%$newstr[0]%' or Sale_Address like '%$newstr[0]%' order by id desc ";时出现了Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operation 'like'的报错。请问谁能猜到怎么回事,该怎么解决?

[解决办法]
肯能输入字符是全角或半角的问题
[解决办法]
$newstr[0]里地内容改变,造成编码不统一,你可以找一种出错的情况,把$sql输出看一下

热点排行