Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路

WBOY
Release: 2016-06-13 13:20:40
Original
1194 people have browsed it

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输出看一下

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!