Store Selected data in a variable with MySQL.connector and Python

How do I get the selected data into a variable?

sql2 = "SELECT * FROM testTable WHERE id=1"  cursor.execute(sql2) 

If I assign cursor.execute(sql2) to x, and print x, x is None. How do I store the info selected in a variable?

Also is my syntax correct for the SQL statement?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.