I have a problem with inserting new rows to the MySQL table.
The name of the table will change, so it must be a variable and with that I have the most trouble.
How can I change name of the table "second" with variable?
add_word = ("INSERT INTO second "
"(name, surname) "
"VALUES (%s, %s)")
data_word = (name1, surname1)
You do it like this:
add_word = "INSERT INTO %s (name, surname) VALUES ('%s', '%s')"%('table_name','name','surname1')
and then you don't need data_word:
cursor.execute(add_word, params=None, multi=False)