>백엔드 개발 >PHP 튜토리얼 >向MYSQL中安插数据不成功

向MYSQL中安插数据不成功

WBOY
WBOY원래의
2016-06-13 10:34:42909검색

向MYSQL中插入数据不成功
报错内容:

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 't produce ultraviolet light, make the ring 6. Its become more clean and comfort' at line 8

ECHO那对数据库插入数据的语句内容如下:

经过测试,应该是re_mark 字段出了问题,因为我尝试对这个字段插入比较少的字数时,是可以成功的。
(re_mark字段的类型定义是:... re_mark text,....

SQL code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->insert into product ( p_name,p_class,p_model,re_mark,pic ) values ( '大幅度反对','大幅度反对','ddfdf','1. Energy saving: 70% energy than common fluorescent lamp; 2. The green environmental protection: LED tube no ultraviolet, such as infrared no radiation and contains no mercury and other harmful substances; 3. Long life: LED tube normal use for 50000 hours; 4. No stroboscopic: LED constant current work, effectively reduce LED light failure, start fast, no flash, protect eyes; 5. Reduce mosquito: different from other light source ultraviolet attract a mosquito, LED don't produce ultraviolet light, make the ring 6. Its become more clean and comfortable; 7. Color is rich: make full use of the advantage of rich color LED production various emitting light colors tubes; 8. Use chip Epistar from taiwan , luminous efficiency is the highest; 9. Shell with 1/2 aluminium, 1/2 PC material, circuit boards use high strength fiber board, combined with compact structure and assembly process, so that only the tube heat sex greatly improved, ensure that LED work in low temperature and try to minimize the LED light failure; 10.The application places: office buildings,factories,shopping malls, schools, public, indoor lighting and colour, such as home decoration and through the CE and ROHS the authentication.', 'upfiles/CR-kNgqQmYmuw.jpg' ) 


------解决方案--------------------
在论坛的加亮的SQL代码模式下,字符串应呈现红色,而你对应 re_mark 的部分却是五彩缤纷
观察红色部分结束的地方 LED don't ,很显然那个“'”么有做转义处理
既然你没有遵守 SQL 指令的书写约定,那么只有自己品尝违规的后果了
------解决方案--------------------
探讨

SQL code

insert into product ( p_name,p_class,p_model,p_speca,p_specb,p_specc,p_specd,p_spece,p_specf,p_specg,p_spech,p_speci,p_specj,p_speck,re_mark,in_time, title,pic ) values ( '2222','3333333',……
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.