Home > Backend Development > PHP Tutorial > php建表的时候怎么给中文字段加上连接校对?

php建表的时候怎么给中文字段加上连接校对?

WBOY
Release: 2016-06-23 14:21:50
Original
1064 people have browsed it

为了解决字符乱码问题,有人告诉我建表的时候给中文字段加上连接校对 gbk_chinese_ci 或 utf8_general_ci
   告诉 mysql 用什么字符集存放数据。

想知道具体怎么加?谢谢


回复讨论(解决方案)

比如
CREATE TABLE `tb_userinfo` (
  `id` int(20) NOT NULL AUTO_INCREMENT,
  `username` varchar(20)  CHARACTER SET utf8 DEFAULT NULL,
  `password` varchar(20) DEFAULT NULL,
  `email` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=latin1

初学者可以用phpmyadmin 之类的图形化工具来选择

有点明白了,谢谢啊

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template