please i need you to help me on this. i am trying to connect python 3.7 to sqlite.
below is the code
below is the code
import sqlite3
from tkinter import *
import tkinter.messagebox
root = Tk()
root.title('Personal Information')
root.resizable(False,False)
root.geometry('500x500+400+150')
####### connect to the Database############################################
conn = sqlite3.connect("database.db")
###### cursor to move around the Database###############################
c = conn.cursor()
def add_data():
val2 = Nameentry.get()
val3 = locentry.get()
val4 = phoneentry.get()
if val2 == '' or val3 == '' or val4 == '':
tkinter.messagebox .showinfo ('Warning','Please fill out all boxes')
sql = "INSERT INTO 'myown'( Name,Location,Phone_Number)VALUES (?,?,?)"
c.execute(sql,(val2,val3,val4))
conn.commit()
tkinter.messagebox .showinfo ('Message','Data Added')
Namelabel = Label(text = 'Name',font = ('ariel,10,bold'),fg = 'black')
Namelabel.place(x = 20,y = 110)
Nameentry = Entry(width = 8,bd = 8,bg ='steelblue',font = ('ariel,10,bold'))
Nameentry.place(x = 100,y = 100)
loclabel = Label(text = 'Location',font = ('ariel,10,bold'),fg = 'black')
loclabel.place(x = 20,y = 150)
locentry = Entry(width = 8,bd = 8,bg ='steelblue',font = ('ariel,10,bold'))
locentry.place(x = 100,y = 150)
phonelabel = Label(text = 'Phone',font = ('ariel,10,bold'),fg = 'black')
phonelabel.place(x = 20,y = 200)
phoneentry = Entry(width = 8,bd = 8,bg ='steelblue',font = ('ariel,10,bold'))
phoneentry.place(x = 100,y = 200)
savebtn = Button(bd = 8,font = ('ariel,10,bold'),fg = 'black',bg = 'steelblue',text = 'SAVE',padx =10, pady = 10,command = add_data)
savebtn.place(x = 200,y = 300)
root.mainloop()it is showing no error when i run but i am not getting the data into the database. please help me out. thanks
