python mysql error 1064 You have an error in your SQL syntax
I'm trying to excute a mysql query but I get the following error:
(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
\'C:/wamp/www/dle/uploads/posts/2013-08/1376251255-IMG11111674.jpg" >\n
\' at line 3')
this is my python code I want to excute:
image_p_add = """
<div>
<!--TBegin:%s|-->
<a href=\"%s\" onclick=\"return hs.expand(this)\" >
<img src=\"%s\" alt=\"%s\" title=\"%s\" />
</a>
<!--TEnd-->
</div><br /><br />
""" % (img_fulladd.replace("_", "\_"),
img_fulladd.replace("_", "\_"), thumb_fulladd.replace("_",
"\_"), post_header[1:-1], post_header[1:-1])
post_shrt_text = "some text" + image_p_add
qu0 = """INSERT INTO dle_post (category, short_story)
VALUES
('1', %s)""" % (post_shrt_text)
cur.execute(qu0)
I checked my code a lot and almost sure that there is no missed quotes.
Any ideas what I might be doing wrong?
No comments:
Post a Comment