python - pymsyql插入文章数据问题
巴扎黑
巴扎黑 2017-04-18 10:24:52
0
3
474

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

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...

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

巴扎黑
巴扎黑

reply all(3)
Ty80

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)
Ty80

Troubleshoot whether the single quotes are not escaped

伊谢尔伦

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!