Answer the question
In order to leave comments, you need to log in
How to change multiple variables at once?
Hello, there is a Sqlighter class that has methods for working with my database (create_table, get_value, etc.). Among them is the update_value() method:
def update_value(self, name, value, chat_id):
"""Обновляем значение переменной в таблице"""
with self.connection:
try:
self.cursor.execute(f"UPDATE chats SET {name}={value} WHERE chat_id = {chat_id}")
except:
self.cursor.execute(f"UPDATE chats SET {name}='{value}' WHERE chat_id = {chat_id}")
db = Sqlighter()
db.update_value("i", i + 1, chat_id)
db.update_value("pressed_satisfied", "", chat_id)
db.update_value("pressed_not_satisfied", "", chat_id)
db.update_value("satisfied_players", 0, chat_id)
db.update_value("not_satisfied_players", 0, chat_id)
db.update_value("got_answer_pressed", 0, chat_id)
db.update_value("rate_question", 0, chat_id)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question