Re: MySQLdb insert HTML code error

Discussion in 'Python' started by Mark Lawrence, Dec 11, 2012.

  1. 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.
     
    Mark Lawrence, Dec 11, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anatoli Hristov

    MySQLdb insert HTML code error

    Anatoli Hristov, Dec 11, 2012, in forum: Python
    Replies:
    0
    Views:
    161
    Anatoli Hristov
    Dec 11, 2012
  2. Anatoli Hristov

    Re: MySQLdb insert HTML code error

    Anatoli Hristov, Dec 11, 2012, in forum: Python
    Replies:
    0
    Views:
    207
    Anatoli Hristov
    Dec 11, 2012
  3. Anatoli Hristov

    Re: MySQLdb insert HTML code error

    Anatoli Hristov, Dec 11, 2012, in forum: Python
    Replies:
    0
    Views:
    188
    Anatoli Hristov
    Dec 11, 2012
  4. Mark Lawrence

    Re: MySQLdb insert HTML code error

    Mark Lawrence, Dec 11, 2012, in forum: Python
    Replies:
    0
    Views:
    178
    Mark Lawrence
    Dec 11, 2012
  5. MRAB
    Replies:
    0
    Views:
    159
Loading...

Share This Page