Python/MySQL "Insert into" with variables -
i have problem inserting new rows mysql table. name of table change, must variable , have trouble. how can change name of table "second" variable? idea?
add_word = ("insert second " "(name, surname) " "values (%s, %s)") data_word = (name1, surname1) cursor.execute(add_word, data_word)
you this:
add_word = "insert %s (name, surname) values ('%s', '%s')"%('table_name','name','surname1')
and don't need data_word:
cursor.execute(add_word, params=none, multi=false)
Comments
Post a Comment