Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34586 > unrolled thread

Re: MySQLdb insert HTML code error

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2012-12-11 00:22 +0000
Last post2012-12-11 00:22 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: MySQLdb insert HTML code error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-12-11 00:22 +0000

#34586 — Re: MySQLdb insert HTML code error

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-12-11 00:22 +0000
SubjectRe: MySQLdb insert HTML code error
Message-ID<mailman.698.1355185240.29569.python-list@python.org>
On 11/12/2012 00:04, Anatoli Hristov wrote:
> Hi all,
>
> I'm facing an issue inserting an html code into the DB, it comes out
> with a syntax error but I face it only when I have html code. Could
> help me escape the error somehow ?
>
> Here is my code
>
> def InsertSpecsDB(product_id, spec, lang, name):
>      db = MySQLdb.connect("localhost","getit","opencart")
>      cursor = db.cursor()
>      sql = ("INSERT INTO product_description (product_id, language_id,
> name, description) VALUES ('%s','%s','%s','%s')")
>      params = (product_id, lang, name, spec)
>      cursor.execute(sql, params)
>      id = cursor.lastrowid
>      print"Updated ID %s description %s" %(int(id), lang)
>      return id
>
> Thanks
>

As much use as a chocolate teapot, all you've given is a function/method 
definition.  No indication of your OS, Python version, calling code, 
what you expect to happen, what actually happened, apart from that your 
request for assistance is perfect.  Usually I'd be able to help but 
sadly my crystal ball is in for repairs at the moment.  Would you please 
be kind enough to elucidate.

-- 
Cheers.

Mark Lawrence.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web