日期:2014-05-17  浏览次数:20502 次

向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

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',……