操作'find_in_set'的排序规则(latin1_swedish_ci,COERCIBLE)和(utf8_general_ci,IMPLICIT)的非法混合 [英] Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (utf8_general_ci,IMPLICIT) for operation 'find_in_set'

查看:71
本文介绍了操作'find_in_set'的排序规则(latin1_swedish_ci,COERCIBLE)和(utf8_general_ci,IMPLICIT)的非法混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:

排序规则的非法组合(latin1_swedish_ci,COERCIBLE)和(utf8_general_ci,IMPLICIT)用于操作'find_in_set'

Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (utf8_general_ci,IMPLICIT) for operation 'find_in_set'

这是我试图执行的查询:

This is the query I was trying to execute:

SELECT ID FROM xs_user_profiles WHERE ID='' AND FIND_IN_SET('1',site_structure);

我查找了此表的属性,它具有字符集utf8和排序规则utf8_general_ci.

I looked up the properties of this table and it has charset utf8 and collation utf8_general_ci.

这在我所有的站点上都很好,所以我不确定出什么问题.

This works well with all my sites so I am not sure what's going wrong.

推荐答案

如果使用的是 mysqli ,请在连接后立即发出以下命令:

If you are using mysqli, issue this command right after connecting:

$mysqli->set_charset("utf8");

这会将您的连接编码设置为 UTF8 (与表使用的相同).

This will set your connection encoding to UTF8 (same as your table uses).

对于普通的 mysql ,请使用以下命令:

With plain mysql, use this:

mysql_query("SET NAMES utf8", $conn);
mysql_query("SET CHARACTER SET utf8", $conn);

这篇关于操作'find_in_set'的排序规则(latin1_swedish_ci,COERCIBLE)和(utf8_general_ci,IMPLICIT)的非法混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆