Home >Backend Development >PHP Tutorial >mysql 数据表 varchar 型数据不能存储 中文吗?该如何处理

mysql 数据表 varchar 型数据不能存储 中文吗?该如何处理

WBOY
WBOYOriginal
2016-06-13 10:03:421200browse

mysql 数据表 varchar 型数据不能存储 中文吗?
INSERT INTO `phptest`.`usermanage` (

`id` ,
`UserName` ,
`PassWord` ,
`Email` ,
`Image` ,
`question` ,//这里是varchar(255)
`anser` ,
`sex` ,
`brithday` ,
`fromwhere` ,//这里是varchar(255)
`web` ,
`qq` ,
`msn` ,
`Icq` ,
`yahoo` ,
`wangwang` ,//这里是varchar(255)
`pay` ,
`Info` ,//这里是varchar(255)
`Lock` 
)
VALUES (
'2', 'waterboy', '88888888', [email protected]', 'http://www.sowa.cn/face/01.gif', '你的爱人是谁', '不告诉你', '1', '1982-03-01', '广州', 'http://www.waterboy.51.cn', '0', [email protected]', '889833', [email protected]', '暗黑正义', [email protected]', '普通人一个', '0'


MySQL 返回: 

#1366 - Incorrect string value: '\xE4\xBD\xA0\xE7\x9A\x84...' for column 'question' at row 1 


varchar 型数据项,填写中文保存就会报错!

------解决方案--------------------
设置mysql数据库的编码为utf-8.

Statement:
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