Code:
x = int(id_[0])
select_query = "SELECT * FROM files WHERE id = %s"
cursor.execute(select_query,x)
results = cursor.fetchone()
I am using mySQL in Python. This is the error I get:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%s' at line
It works when I get rid of the variable and just add a random id like 1.
cursor.execute()should be an iterable:cursor.execute(select_query,(x,))%sin your actual query?