No error, but unable to insert row in a table

Keywords: web flask mysql-python flask-wtforms


Hi I have been working on a flask web app, It has many tables with relation among themselves. One table is users_email.

| user_id | email            |
|       6 |   |
|       9 | |

I am trying to insert a row from a flask route @app.route('/get_email')

@app.route('/get_email', methods=['GET', 'POST'])
def get_email():
    if form.validate_on_submit():

        email =['user_id'])
        cur = mysql.connection.cursor()
        cur.execute("INSERT INTO users_email(user_id, email) VALUES(%s, %s)",(session['user_id'], email))'query executed sucessfully!!! check the table if it did or not!')
        flash('Registered email sucessfully!', 'success')
        return redirect(url_for('admin_options'))
    return render_template('get_email.html', title='Register your email', form=form)

when I directed to this route, it executed perfectly with out any error and after completing this, as this route should do it get redirected to 'admin_option'. if I see back in the data base there are no new row gets entered