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

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

WBOY
Release: 2016-06-13 13:52:05
Original
1688 people have browsed it

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', 'waterboy@163.com', 'http://www.sowa.cn/face/01.gif', '你的爱人是谁', '不告诉你', '1', '1982-03-01', '广州', 'http://www.waterboy.51.cn', '0', 'waterboy@hotmail.com', '889833', 'waterboy@yahoo.cn', '暗黑正义', 'kira@163.com', '普通人一个', '0'


MySQL 返回: 

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


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

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

Related labels:
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