Answer the question
In order to leave comments, you need to log in
Why is the iteration being dropped?
Look... I'm getting
data
name = add_e11.get()
start = add_e12.get()
finish = add_e13.get()
grp_name = add_e14.get()
I'm extracting 3 records from the database
sql = 'SELECT ID_USER FROM grp WHERE NAME_GRP =?'
data = cur.execute(sql,( grp_name, )) # List of climbers in the group
conn.commit()
There are three of them...
I iterate over them and get 1,2,3 on the screen (climbers indexes)
for i in data:
id_user = i[0]
print(id_user) # Вывод 1,2,3
for i in data:
id_user = i[0]
sql = 'INSERT INTO sunrise(NAME_MNT,DATA_START,DATA_FINISH,ID_USER,NAME_GRP) VALUES(?,?,?,?,?)'
cur.execute(sql,( name,start,finish,id_user,grp_name ))
conn.commit()
Answer the question
In order to leave comments, you need to log in
Why use conn.commit() when reading, this line saves data in the database after the add/change request is executed? To get it, use fetchall(), and when writing, try to use INSERT OR UPDATE, depending on how the table was conceived
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question