Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路
程序员文章站
2022-05-28 22:49:48
...
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输出看一下
我的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输出看一下
相关文章
相关视频
上一篇: 在Struts中使用Tiles框架
推荐阅读
-
解决 Mysql Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
-
对mysql Illegal mix of collations(gbk_chinese_ci,IMPLICIT) a_MySQL
-
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路
-
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路
-
解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) a
-
解决 Mysql Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
-
对mysql Illegal mix of collations(gbk_chinese_ci,IMPLICIT) a_MySQL
-
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
-
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=