用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2973|回复: 6
收起左侧

[已解决] 数据编码问题

[复制链接]
发表于 2012-2-16 10:57:19 | 显示全部楼层 |阅读模式

Error Number: 1267

Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

SELECT * FROM (`go_categories`) WHERE `type` = '����' LIMIT 12

Filename: /var/www/html/go/controllers/index.php

Line Number: 30


我数据库编码设置为GBK   在$db['default']['char_set'] = 'gbk'; 和页面 都为gbk   

在XP的机器上 运行没有问题  ,   但是搬到Centos上面运行报了上面的错,   

我个人认为是$db['default']['char_set'] = 'gbk';  无效 导致的原因,也许是配置问题,但是就是不知道到底是哪里配置出错XP里面没问题的。

       求大神解决



 楼主| 发表于 2012-2-16 11:14:44 | 显示全部楼层
没人回答吗?
发表于 2012-2-16 11:25:23 | 显示全部楼层
什么数据库?
 楼主| 发表于 2012-2-16 11:34:26 | 显示全部楼层
MYSQL
发表于 2012-2-16 11:42:46 | 显示全部楼层
$db['default']['dbcollat'] 你改了吗?这个默认是
PHP复制代码
$db['default']['dbcollat'] = 'utf8_general_ci';
复制代码

要改成 gbk 相应的值。
 楼主| 发表于 2012-2-16 12:29:57 | 显示全部楼层
配置如下:
1.数据库编码为 GBK
2.$db['default']['char_set'] = 'gbk';
   $db['default']['dbcollat'] = 'gbk_general_ci';
3.PHP Apache 配置都正确
        Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
         我可能哪里还没注意到  请指教   
   
 楼主| 发表于 2012-2-16 15:42:38 | 显示全部楼层
$db['default']['dbcollat'] = 'utf8_chinese_ci';  
  应该是这个  尴尬

本版积分规则