Answer the question
In order to leave comments, you need to log in
Why is data not being written to SQlite?
def add_randcode(self, code):
with self.connection:
code = self.cursor.execute("SELECT * FROM `subscriptions` WHERE `code` = ?", (code, )).fetchone()
if code == None:
code = random.randint(1000,9999)
self.cursor.execute("""INSERT INTO subscriptions(code)
VALUES (?)""", (code, ))
return code
else:
return code
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