I have 2 things I needed help with:

1) I am unsure as to how I can check if a table exists in python using the `sqlite3` library. 

2) I am unsure as to how I can save variables from the program to a database. I want to be able to check if `UserDetails` exists before making the database.

I've been reading around and everyone is doing stuff differently, 

Here is the section of my code that is responsible for saving the variables:

```
    connection = sqlite3.connect("UserDetails.db") 
    crsr = connection.cursor() 

    #create table
    sql_command = table_creator
    crsr.execute(sql_command)

    #insert values into table
    data_to_insert = (username, first_name, surname, age, user_salt, password_hash, date_today)
    sql_command = """INSERT INTO UserDetails VALUES ((?, ?, ?, ?, ?, ?, ?), data_to_insert);"""
    crsr.execute(sql_command)

    connection.commit() #save changes
    connection.close()  #terminate connection

```

and in case you want to see `table_creator` it looks like this:

`table_creator = '''CREATE TABLE `UserDetails` (
 `Username` VARCHAR(8) NOT NULL,
 `Firstname` VARCHAR(10) NOT NULL,
 `Surname` VARCHAR(20) NOT NULL,
 `Age` INT(2) NOT NULL,
 `Salt` VARCHAR(10) NOT NULL,
 `Hash` VARCHAR(64) NOT NULL,
 `Date` DATE NOT NULL,
 PRIMARY KEY (`UserName`)
 );'''`

I will appreciate and feedback or support. 
I am still learning to code, and my CompSci teacher doesnt teach us Python specifically, so what I know is self taught.

Oh and this is the error message I get:

```
Traceback (most recent call)
  File "c:/Users/Arslan/Project A2/login.py", line 99, in <module>
    save_details()
  File "c:/Users/Arslan/Project A2/login.py", line 93, in save_details
    crsr.execute(sql_command)
sqlite3.OperationalError: no such column: data_to_insert

```