0

This is my code, i have a form in HTML where an user can register then i try to save his registration data on mySQL DB, it says not all parameters are being used. Any solutions? The code is below

@app.route("/register", methods = ['GET', 'POST'])
def register():
    ##server = smtplib.SMTP("smtp.gmail.com",587)
    
    
    if request.method == 'POST':
        #Parse form data    
        password = request.form['password']
        email = request.form['email']
        firstName = request.form['firstName']
        lastName = request.form['lastName']
        conn = mysql.connector.connect(user='root', password='', host='localhost', database='mbvenditore')
        cursor = conn.cursor(dictionary=True)
        
        
        
        #query = ("INSERT INTO users (password, email, nome, cognome, indirizzo1, indirizzo2, cap, citta, provincia, stato, telefono) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s")
        #cursor.execute("INSERT INTO utenti (idutente,password, email, nome, cognome) VALUES (NULL,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)")
        #cursor.execute('INSERT INTO utenti VALUES (% s, % s, % s, % s)', (password, email, firstName,lastName, ))
        cursor.execute('INSERT INTO utenti VALUES (%s , % s, % s, % s)', (password, email, firstName,lastName, ))
        
    return render_template("login.html")
  • 1
    You have spaces between % and s. It seems that can be an issue. Second thing, why do you have a comma after lastname? – Daniyal Ishfaq Mar 22 '22 at 10:14
  • 1
    Does this answer your question? [Not all parameters were used in the SQL statement (Python, MySQL)](https://stackoverflow.com/questions/20818155/not-all-parameters-were-used-in-the-sql-statement-python-mysql) – LSeu Mar 22 '22 at 10:15
  • @DaniyalIshfaq Thank you so much, i spent 2 days complaining on this dammit error, thank you again! – user18287983 Mar 22 '22 at 10:18

1 Answers1

0

You have spaces between % and s. It seems that can be an issue. Second thing, why do you have a comma after lastname? – Daniyal Ishfaq