I
Ilya Knizhnik
Hi all,
I'm having a problem inserting into a mysql database (its not the mysql, its
the encoding of the query sting), could someone point me in the
right direction. The code resembles the following:
text1=hdtext.encode("utf-8") #this is acquired earlier in the script
string1="just testing"
#this first one would work fine
cursor.execute("insert into table1 (col1) values (%s)" %(text1))
#the next one works too
cursor.execute("insert into table1 (col2) values ('%s')" %(string1))
#however what i need to work is the following
cursor.execute("insert into table1 (col1,col2) values (%s,'%s')"
% (text1,string1)
Thanks,
Ilya
I'm having a problem inserting into a mysql database (its not the mysql, its
the encoding of the query sting), could someone point me in the
right direction. The code resembles the following:
text1=hdtext.encode("utf-8") #this is acquired earlier in the script
string1="just testing"
#this first one would work fine
cursor.execute("insert into table1 (col1) values (%s)" %(text1))
#the next one works too
cursor.execute("insert into table1 (col2) values ('%s')" %(string1))
#however what i need to work is the following
cursor.execute("insert into table1 (col1,col2) values (%s,'%s')"
% (text1,string1)
Thanks,
Ilya