mistertwst
mistertwst

Reputation: 75

Python MySQL Error 1210: Incorrect number of arguments executing prepared statement

I'm trying to write to a database as follows, but I get this error:

1210: Incorrect number of arguments executing prepared statement

Execute statement:

query = "INSERT INTO db.tbl1(name, msg) VALUES (%s,%s)"
cursor.executemany(query, ([message.author.name], [message.content]))
mydb.commit()

Sorry im new to this. Any idea why?

Upvotes: 0

Views: 482

Answers (1)

prhmma
prhmma

Reputation: 953

you are doing it wrong try this :

cursor.executemany(query, [(message.author.name, message.content)])

Upvotes: 1

Related Questions