In my Cur4.execute, I am trying to compare the artist name with the one I obtained before from cur3 (name = row[1]), but I got errors:
Traceback (most recent call last):
File "mp2.py", line 49, in <module>
cur4.execute('SELECT * FROM artist WHERE artist.name = %s',name)
File "C:\python27\lib\site-packages\MySQLdb\cursors.py", line 187, in execute
query = query % tuple([db.literal(item) for item in args])
TypeError: not all arguments converted during string formatting
How should I fix it?
cur3 = db.cursor()
cur3.execute("SELECT image.link, artist.name, detail.detail_id, FROM artist, detail, image WHERE image.artist_id = artist.artist_id AND detail.image_id = image.image_id LIMIT 1")
ans = cur3.fetchall()
for row in ans:
print row[1:]
name = row[1]
db.close()
cur4 = db.cursor()
cur4.execute('SELECT * FROM artist WHERE artist.name = %s',name)