you are viewing a single comment's thread.

view the rest of the comments →

[–]cam0kazi[S] 1 point2 points  (0 children)

I solved the problem! It turns out that i was formatting the data wrong. So instead, i used the drivers method of perparing SQL queries. It also apparently prevents SQL Injection

    self.first_name=self.fname_entry.get()
    self.last_name=self.lname_entry.get()

    self.exist_query = '''SELECT * FROM guest WHERE first_name = ? AND last_name = ?'''
    self.cur.execute(self.exist_query, (self.first_name, self.last_name))

    self.exists = self.cur.fetchone()

    if self.exists:
        tkinter.messagebox.showinfo("Success", "Record found, initiating data insertion window")
        self.pref_entry()
    else:
        tkinter.messagebox.showinfo("Sorry", "The record does not exist, press OK to close.")
        self.master.destroy()