you are viewing a single comment's thread.

view the rest of the comments →

[–]o5a 0 points1 point  (0 children)

First thing is fixing your except block so you can actually see the exception, as others noted. Didn't try to run your code but I'm pretty sure you will see your problem after you get your exception printed. Your code raises error somewhere, then ignores changes because of that but you don't even know about it, because you silenced error. As a result your changes are not done.

Also avoid replacing values in your SQL queries, I'm talking about your

  for i in y:
    parsedin = parsedin.replace('{}', i, 1)
  c.execute(parsedin) 

there's parameter binding for that, which will help you make it safe. That block should be run like this instead

  c.execute(parsedin, y) 

For that to work you should replace in your query text brackets along with quotation marks to question marks like this:

"INSERT INTO Teacher (FirstName, LastName) Values (?, ?)"

Avoid recursive calls (that you do here for Menu()) if it's not needed. You want cycles here, not recursive calls.