解决mysql的错误 CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1300 Invalid utf8 character string: '\xBF\xA5'

 

=》已经解决:

 

报错:

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1300 Invalid utf8 character string: '\xBF\xA5'

解决方法:

 

在mysql插入数据的时候,value部分的数值尽量用“引号”包起来,这样就不会报告这个错误了。

如下:规定字段num是数值型

insert into tbname(`id`,`num`) values('','11xxx')

=》字段num的类型是数字,因为'11xxx'用了单引号,插入数据库的最终结果就会自动过变成 '11',且不会报告错误。


 

posted @ 2017-07-11 16:36  素还真1990  阅读(3434)  评论(0)    收藏  举报