lazerorca
lazerorca

Reputation: 33

Syntax error with placeholder in python with sqlite INSERT command

I am getting an error with the second placeholder on MySQL query:

photo_number_value = c.execute('INSERT into ebay VALUES (?,?)', photo_number_key,photo_number)

the error that I'm getting is:

unexpected argument

Upvotes: 1

Views: 1857

Answers (1)

tdelaney
tdelaney

Reputation: 77377

Syntax errors and "unexpected argument" errors are different things. But since execute only takes two parameters, I'll go with the latter. You need to put the parameter values into a list or tuple to make it work:

photo_number_value = c.execute('INSERT into ebay VALUES (?,?)',
    (photo_number_key,photo_number))

Upvotes: 3

Related Questions