Re: MySQLdb insert HTML code error

2012-12-11 Thread Chris Angelico
On Tue, Dec 11, 2012 at 11:46 AM, Anatoli Hristov toli...@gmail.com wrote: Brilliant, I think your problem is in line 97 of the code that you *HAVEN'T QUOTED*. Please go here, read and inwardly digest before you say anything else http://www.sscce.org/ :) I thought it was clear. the spec is

Re: MySQLdb insert HTML code error

2012-12-11 Thread Anatoli Hristov
SSCCE starts with Short. The HTML you unloaded into that email hardly qualifies. When you're trying to figure out a problem that appears to happen only when you have X and not when you have Y, see what the smallest example data for X and Y are that continue to exhibit the difference. It's

MySQLdb insert HTML code error

2012-12-10 Thread Anatoli Hristov
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)

Re: MySQLdb insert HTML code error

2012-12-10 Thread Mark Lawrence
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):

Re: MySQLdb insert HTML code error

2012-12-10 Thread Anatoli Hristov
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

Re: MySQLdb insert HTML code error

2012-12-10 Thread Anatoli Hristov
On Tue, Dec 11, 2012 at 1:29 AM, Anatoli Hristov toli...@gmail.com wrote: 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

Re: MySQLdb insert HTML code error

2012-12-10 Thread Mark Lawrence
On 11/12/2012 00:29, Anatoli Hristov wrote: 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.

Re: MySQLdb insert HTML code error

2012-12-10 Thread MRAB
On 2012-12-11 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):

Re: MySQLdb insert HTML code error

2012-12-10 Thread Anatoli Hristov
You're using a parametrised query (which is good :-)), but you've included quotes around the placeholders. There's no need to do that. They'll be quoted automatically when necessary: sql = INSERT INTO product_description (product_id, language_id, name, description) VALUES (%s,%s,%s,%s)

Re: MySQLdb insert HTML code error

2012-12-10 Thread Anatoli Hristov
First thing -- DON'T put quotes around the %s place-holders... The whole purpose of using the parameterized .execute() is to let the database adapter properly escape the parameters before putting them into the SQL (since MySQL didn't have prepared statements before v5, it was producing