I tryied to in insert and select in the same time in mysql PyQt5 but the program didn't work.
the program is working till i tryied to insert and selectin the same time in MySql.
This is the code before I got the issue :
self.groupe.currentTextChanged.connect(self.grouchan)
def grouchan(self):
global id_filint
qidmat = "select Id_filiere from filiereacademiquecsv where Libelle_filiere_francais=%s"
ridmat = (self.txt_filiere.text(),)
mycursor.execute(qidmat, ridmat)
myresult = mycursor.fetchone()
for idf in myresult:
id_filint = idf
qmat = "select distinct Id_matiere from matiereunité m inner join filiereacademiquecsv f on f.Id_filiere=m.Id_filieranalytiq where Id_filieranalytiq=%s and Libelle_matiere_francais=%s"
rnp1 = (id_filint, self.matiere.currentText())
mycursor.execute(qmat,rnp1)
myresult1 = mycursor.fetchone()
for i in myresult1:
print(i)
qgrp = "select idgroupe from groupcyclniv where LibGroupe=%s"
rnp3 = (self.groupe.currentText(),)
mycursor.execute(qgrp, rnp3)
myresult2 = mycursor.fetchone()
for v in myresult2:
print(v)
This is where I got the issue.
This is where I tryied to insert and select :
qnp = "insert into mobile (Id_eleve, nomprenom, Id_matiere) SELECT a.IdEleve,e.nomprenom,m.Id_matiere FROM asselevgroupevf a inner join eleve e inner join matiereunité m on a.IdEleve = e.Ideleve where a.IdGroup =%s and Id_matiere =%s"
rnp1 = (v, i)
mycursor.execute(rnp1, qnp)
mydb.commit()
question from:
https://stackoverflow.com/questions/65902223/i-tryied-to-in-insert-and-select-in-the-same-time-in-mysql-pyqt5 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…