I'm working on a function in python that reads values from MySql. When I insert using the same format there are no errors but when I select it gives me the error mysql.connector.errors.ProgrammingError: Could not process parameters: str(555), it must be of type list, tuple or dict Here is my code that is giving the error
cursor.execute('SELECT * FROM LIBS')
result = cursor.fetchall()
for row in result:
user_id = row[0]
song_id = row[1]
if(user_id == userno):
cursor.execute("SELECT s_title FROM SONG WHERE s_id = (%s)", (song_id))
print(row[1])
What I don't understand is when I use the exact same format for INSERT with (%s) there are no errors
I tried adding a comma inside the song_id and then running them as cursor.execute("SELECT s_title FROM SONG WHERE s_id = (%s)", (song_id,)) but I got the error mysql.connector.errors.InternalError: Unread result found.