Phpmysql table Chinese garbled problem how to solve
Create database zzjz character set gbk COLLATE gbk_chinese_ci;
Create table zz_employees (employeeid int unsigned not null auto_increment primary key, name varchar (13) not null, updatetime datetime) character set gbk COLLATE gbk_chinese_ci;
- Create table zz_configitems (itemid int unsigned not null auto_increment primary key, itemname varchar (12) not null) character set gbk COLLATE gbk_chinese_ci;
- Create table zz_items (itemid int unsigned not null, employeeid int unsigned not null, item varchar (200) not null, primary key (itemid ),
- Foreign key (itemid) REFERENCES zz_configitems (itemid) on update cascade, foreign key (employeeid) REFERENCES zz_employees (employeeid) on update cascade) character set gbk COLLATE parameters;
-
You can also specify the gbk encoding when creating a table. Of course, you can also use the following command to modify the character set of the database:
- Alter database da_name default character set 'charset '.
The client sends data in gbk format. the following configurations can be used:
- SET character_set_client = 'gbk'
- SET character_set_connection = 'gbk'
- SET character_set_results = 'gbk'
The above describes how to solve the problem of Chinese garbled characters in data tables in pyh mysql programming. |