Home  >  Q&A  >  body text

python - pymsyql插入文章数据问题

就是插入文章数据的时候,可能是因为有标签的缘故出现这样的问题,如图:

pymysql.err.ProgrammingError: (1064, '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 \'q</p>\n                <p id="_j_p...

该怎么解决?修改字段类型?谢谢了

巴扎黑巴扎黑2740 days ago484

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:26:52

    You have to use it

    sql = " insert into t_a (a,b,c) values (%s, %s,%s)"
    db.execute(sql, a, b,c)
    

    Way

    I guess you use it

    sql = " insert into t_a (a,b,c) values (%s, %s,%s)" % (a,b,c)
    db.execute(sql)

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:26:52

    Troubleshoot whether the single quotes are not escaped

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:26:52

    It may be that the field uses "keywords". Check it and change the length to be larger.

    reply
    0
  • Cancelreply