Answer the question
In order to leave comments, you need to log in
How to get all parameters from sqlite database?
I need to check all values before entering into the database and if there is an exact match, then get the id of this line, if not, then get 0 in response. I
wrote the following script:
def chek_db(a):
conn = sqlite3.connect('database.sqlite')
res = conn.execute("SELECT q_id, q_title FROM q_main WHERE q_title LIKE" + '\'' + a + '\'')
res1 = len(res.fetchall())
if res1 == 0:
result = 0
else: result = 1
return (result)
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