D
D
Dnmesr2021-12-15 23:13:35
Python
Dnmesr, 2021-12-15 23:13:35

How to add values ​​to db?

Let's say the value is 30, you need to add another 30 to it to get 60.
How can this be done?

def set_time_sub(self, user_id, time_sub):
        with self.connection:
            return self.cursor.execute("UPDATE `users` SET `time_sub` = ? WHERE `user_id` = ?", (time_sub, user_id,))


time_sub = int(time.time()) + days_to_seconds(30)
            db.set_time_sub(message.from_user.id, time_sub)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-12-15
@Dnmesr

UPDATE `users` SET `time_sub` = `time_sub` + ? WHERE `user_id` = ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question