MySQL Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Arial','sans-serif'" lang=EN-US>2)&nb' at line 1 MySQL Errno:1064 Message:MySQL Query Error本地调试

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 12:03:50

MySQL Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Arial','sans-serif'" lang=EN-US>2)&nb' at line 1 MySQL Errno:1064 Message:MySQL Query Error本地调试
MySQL Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Arial','sans-serif'" lang=EN-US>2)&nb' at line 1
MySQL Errno:1064
Message:MySQL Query Error
本地调试完全正常.
mysql语句肯定没错
传到服务器上后,将字符串中的style="FONT-FAMILY:'Arial','sans-serif'" lang=EN-US去掉就可以正常存入数据库.
服务器版本linux CentOS5.0
1,都是连接的localhost本地数据库,且都用的root用户.
2.style="FONT-FAMILY:\'Arial\',\'sans-serif\'" 这个也不太现实,因为这个是在线编辑器自动生成的,基本上所有的编辑器都是用过了,都是这个错.

MySQL Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Arial','sans-serif'" lang=EN-US>2)&nb' at line 1 MySQL Errno:1064 Message:MySQL Query Error本地调试
这是因为单双引号没转义造成的sql失效.
提交的编辑器内容使用
addslashes()来进行转义后再保存,
展示时使用
stripslashes()先去除转义再来展示.
======
详细例子请翻阅手册.没有手册去官方网站上查.当然是英文的.呵呵.