Answer: The garbled code problem in MySQL 5.0.16 can be solved by the following method:
1. Set up phpMyAdmin
Language:Chinese simplified (zh-utf-8) MySQL character set: UTF-8 Unicode (utf8) MySQL connection proofreading gbk_chinese_ci |
2. When creating the database
, set it to gbk_chinese_ci
3. Use SQL to create the table
ENGINE=MyISAM DEFAULT CHARSET=gbk; ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40; |
the collation attribute of varchar(100)
in the table structure
is gbk_chinese_ci andthat the collation attributes of other types are empty.
5. Add
$db->query("SET CHARACTER SET GBK"); required under Linux but not required under Windows.
This operation is equivalent to Connection Character Sets and Collations