MySQL5.0.16乱码问题处理办法

来源:互联网 发布:大庆网络主管招聘 编辑:程序博客网 时间:2024/05/23 17:35
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
.Nxa946{display:none;}

 


 1设置phpMyAdmin

Language:Chinesesimplified(zh-utf-8)
MySQL字符集:UTF-8Unicode(utf8)
MySQL连接校对gbk_chinese_ci

 2创建数据库时

整理设置成gbk_chinese_ci

 3用SQL建立表中

ENGINE=MyISAMDEFAULTCHARSET=gbk;
ENGINE=InnoDBDEFAULTCHARSET=gbkAUTO_INCREMENT=40;

 4检查表结构中

varchar(100)的整理属性为gbk_chinese_ci
其它类型的整理属性为空

 5代码中加上

$db->query("SETCHARACTERSETGBK");Linux下需要,Windows下不需要
这个相当于ConnectionCharacterSetsandCollations

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>