This is not a [duplicate] i have tried the questions given in SQLite3 Python – Checking if an entry exists
but it doesn’t works for me looked up on some more tutorials but still couldn’t find anything that works for me
some useful code –
f = ('Times', 14)
con = sqlite3.connect('userdata.db')
cur = con.cursor()
cur.execute('''CREATE TABLE IF NOT EXISTS record(
name text,
email text,
contact number,
gender text,
country text,
password text
)
''')
con.commit()
and –
if check_counter == 10:
try:
con = sqlite3.connect('userdata.db')
cur = con.cursor()
cur.execute("INSERT INTO record VALUES (:name, :email, :contact, :gender, :country, :password)", {
'name': register_name.get(),
'email': register_email.get(),
'contact': register_mobile.get(),
'gender': var.get(),
'country': variable.get(),
'password': register_pwd.get()
})
con.commit()
messagebox.showinfo('confirmation', 'Record Saved')
except Exception as ep:
messagebox.showerror('', ep)
else:
messagebox.showerror('Error', warn)
>Solution :
If you want to see if data is in a database then query the database for the data you want and if it returns the result then its in the database and if not then its not in the database.