con = pymysql.connect(host='localhost', user='root', password='Sidiham',
database='base_ratibor_new') # подключим базу данных
with con:
cur = con.cursor()
comanda = f"update `user` set `FIO`=%s where id=%s;"
cur.execute(comanda, (self.FIO.text(), currentId)) # сам запрос, собственно
con.commit() # эта строка исправляла всёёёёё
comanda = f"update `user` set `social_status`=%s where id=%s;"
cur.execute(comanda, (self.lineEdit_2.text(), currentId)) # сам запрос, собственно
con.commit() # эта строка исправляла всёёёёё
value1 = int(self.roleId_box.currentIndex())
comanda = f"update `user` set `role_id`=%s where user.id=%s;"
cur.execute(comanda, (value1, currentId)) # сам запрос, собственно
con.commit() # эта строка исправляла всёёёёё
cur.close()
elif self.radioButton_2.isChecked():
# для начала получим id пользователя
currentId = self.listWidget_2.currentItem().text()
curRows = currentId.split(",")
currentId = curRows[3]
currentId = int(currentId[1:len(currentId) - 1])
con = pymysql.connect(host='localhost', user='root', password='Sidiham',
database='base_ratibor_new') # подключим базу данных
with con:
cur = con.cursor()
comanda = f"update `comments` set `text`=%s where id=%s;"
cur.execute(comanda, (self.text.text(), currentId)) # сам запрос, собственно
con.commit() # эта строка исправляла всёёёёё
cur.close()
def main():
app = QtWidgets.QApplication(sys.argv) # Новый экземпляр QApplicationpyqt5designer
window = Base() # Создаём объект класса Base
window.show() # Показываем окно
app.exec_() # и запускаем приложение
if __name__ == '__main__': # Если мы запускаем файл напрямую, а не импортируем
main() # то запускаем функцию main()