duanguan3863 2015-02-03 12:31
浏览 40

SQL语法中有什么错误

what is this error meaning:

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 times new roman; font-size: x-large; color: #a67859;> at line 1

query

 update page set en_title = 'Team', 
  en_content = ' Jasmine Low Sales & Marketing Manager (Singapore) ', image_1 = 'Shirley.jpg',

image_2 = 'Jessica.jpg', keyword = 'test', description = '' where id_page = '3'

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 'times new roman'; font-size: x-large;">Cheryl Koh
  • 写回答

1条回答 默认 最新

  • doujing5150 2015-02-03 13:03
    关注

    Your query :

    update page
    set en_title = 'Team',
        en_content = ' Jasmine Low Sales & Marketing Manager (Singapore) ',
        image_1 = 'Shirley.jpg',
        image_2 = 'Jessica.jpg',
        keyword = 'test',
        description = ''
    where id_page = '3'
    

    is correct but your SQL script or how you run your SQL script contains the error.

    If your error comes from the en_content containing the phrase "'times new roman'; font-size: x-large;" then you should better use a prepared statement instead of concatenating arbitrary string with your SQL (which could cause SQL injection by the way).

    PREPARE stmt1 FROM 'update page
    set en_title = ?,
        en_content = ?,
        image_1 = ?,
        image_2 = ?,
        keyword = ?,
        description = ?
    where id_page = ?';
    
    set @en_title = 'Team';
    set @en_content = ' Jasmine Low Sales & Marketing Manager (Singapore) ';
    set @image_1 = 'Shirley.jpg';
    set @image_2 = 'Jessica.jpg';
    set @keyword = 'test';
    set @description = '';
    set @id_page = '3';
    
    EXECUTE stmt1 USING @en_title, @en_content, @image_1, @image_2, @keyword, @description, @id_page;
    
    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器