I'm running into this issue when using mySQL. My result = [{'email': 'bernie@shrimp.com'}] but I'm getting an TypeError: tuple indices must be integers or slices, not str when I'm doing email = results[0]['email']
The thing is when I'm running this locally it works perfectly. How do I get bernie@shrimp.com?
users is a table
Code:
cursor.execute('SELECT email FROM users WHERE username = %s', [attempted_username])
email_dict = cursor.fetchall()
print(email_dict)
session['email'] = email_dict[0]['email']
Console:
[{'email': 'bernie@shrimp.com'}]