title: sqlite3 registration database not updating
body: <p>I'm making a simple registration page in Flask using sqlite. I did a test run manually and this worked:</p>
  <pre><code>import sqlite3
  db = sqlite3.connect('database.db')
  c = db.cursor()
  
  username = &quot;bb&quot;
  password = &quot;vv&quot;
  
  c.execute(&quot;INSERT INTO users (username, password) VALUES (?, ?)&quot;, (username, password))
  db.commit()
  </code></pre>
  <p>But I can't get this to work in my app.py (below is a greatly simplified version)</p>
  <pre><code>@app.route(&quot;/register&quot;, methods=[&quot;GET&quot;, &quot;POST&quot;])
  def register():
      if request.method == &quot;POST&quot;:
          username = request.form.get(&quot;username&quot;)
          password = request.form.get(&quot;password&quot;)
          confirmation = request.form.get(&quot;confirmation&quot;)
  
          try:
              c.execute(&quot;INSERT INTO users (username, password) VALUES (?, ?)&quot;, (username, password))
              db.commit()
              return render_template(&quot;login.html&quot;)
          except:
              return apology(&quot;username is already registered&quot;)
  
      else:
          return render_template(&quot;register.html&quot;)
  </code></pre>
  <p>I get redirected to my apology page (Username is already registered). My database.db is empty :( Any help would be appreciated, new to the community and coding.</p>