What is the MySql UPDATE equivalent of this ?
INSERT INTO items (title, url) VALUES (%s, %s)", (listtitle[0], listlink[0]))
What is the MySql UPDATE equivalent of this ?
INSERT INTO items (title, url) VALUES (%s, %s)", (listtitle[0], listlink[0]))
"update items
set title = '{0}',
url = '{1}'
where COLUMN = VALUE
and COLUMN2 = VALUE2".format(listtitle[0], listlink[0])
Replace the words in uppercase with the specific values or otherwise you would update the whole table.
Unknown column in 'field list' error on MySQL Update query
Try this
self.cursor.execute("UPDATE items SET descs ='{0}'".format(item['title'][0]))
instead of this
self.cursor.execute('UPDATE items SET descs =%s' % item['title'][0])
Try this:
"UPDATE items SET title = %s, url= %s" % listtitle[0], listlink[0]