title: Inserting into a table where two other conditions are met
body: <p>In my program, the teacher user creates a class and it is added to the database. They then input the full-name of a student, where it is split and searched for in the database. If found, the name of the class is inserted into the students row. I am having issues inserting the class name into where the values for the first and lastname are the same as those inputted by the teacher.</p>
  
  <p>This is the code for the creation of the table for users:</p>
  
  <pre><code>c.execute("""CREATE TABLE IF NOT EXISTS users (
              UserID text PRIMARY KEY,
              FName text,
              SName text,
              username text,
              password varchar,
              userType text,
              ClassName text,
              FOREIGN KEY ("ClassName") REFERENCES "ClassInfo"("ClassName"));""")
  </code></pre>
  
  <p>This is the code used to insert the classname into the table for the student. It works up till the final command where I try inserting.</p>
  
  <pre><code>studentname = (var_studname.get())
          conn = sqlite3.connect('MyComputerScience.db')
          print (studentname)
          c = conn.cursor()
          firstName, lastName = studentname.split(" ")
          c.execute ("SELECT * FROM users WHERE FName = ? AND SName= ? AND  usertype = 'Student'", (firstName, lastName,))
          results = c.fetchall()
          if len(results) == 0:
              Label(screen6, text = "Student doesn't exist!", fg="RED").place(relx=0.101, rely=0.725, height=21, width=194) 
          else:
              Label(screen6, text = ""+firstName+" Added!", fg="Green").place(relx=0.101, rely=0.725, height=21, width=194) 
              var_inserttoclass = (var_classname.get(), firstName, lastName, )
              c.execute('insert INTO users (ClassID) WHERE FName = ? AND SName= ?  VALUES (?,?,?);', var_inserttoclass)
              conn.commit()
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>c.execute('insert INTO users (ClassID) WHERE FName = ? AND SName= ?  VALUES (?,?,?);', var_inserttoclass)
  sqlite3.OperationalError: near "WHERE": syntax error
  </code></pre>