getting an error while fetching data from database (mysql). n="+".join(n) TypeError: can only join an iterable

conn = mysql.connector.connect(host="localhost", user="root", password="", database="Attendance")
my_cursor = conn.cursor()

                            my_cursor.execute("select Name from student where Student_id="+str(id))
                            n=my_cursor.fetchone()
                            n="+".join(n)

>Solution :

Please check the value of n before joining if it is an iterable. Probably it’s None.

Leave a Reply