Python Flask,并不是所有的参数都被用于SQL



这是我的代码,我有一个HTML格式的表单,用户可以在其中注册,然后我尝试将他的注册数据保存在mySQL DB上,它说不是所有参数都在使用。有什么解决方案吗?代码低于

@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")

在%和s之间有空格。这似乎是个问题。第二件事,为什么姓氏后面有逗号Daniyal Ishfaq

最新更新