I am trying to insert HTML code into a field in a MySQL db.
I use the following code to do it
cur.execute("INSERT INTO `table1`(field1) VALUES("+ str(data) +")")
But I get the following error:
_mysql_exceptions.ProgrammingError: (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 \'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.or\' at line 3')
How can I solve this problem? Thanks in advance!
datalook like, b) please please please don't use string concatenation to create SQL queries, use prepared statements or an ORM