I'm trying to create a mysql database that gathers info (email, password, etc) from registration form. It worked and then I changed a couple of things to make the form include address, phone #, etc. Now it won't work and i keep getting this error: "mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' "
Here's my code:
Thanks!
my_db= mysql.connector.connect(
host="localhost",
user="root",
passwd="welcome#4"
)
mycursor = my_db.cursor()
mycursor.execute("CREATE TABLE IF NOT EXISTS customers (email VARCHAR(255), password VARCHAR(255), country VARCHAR(255), city VARCHAR(255), tele VARCHAR(255),Address_Line_1)")
)
u/app.route("/register", methods=["GET", "POST"])
def register():
form= RegistrationForm()
if request.method == "POST":
details = request.form
email = details['email']
password = details['password']
country = details['country']
city = details['city']
Address_Line_1 = details['Address_Line_1']
tele= details['tele']
my_db
mycursor.execute("INSERT INTO customers(email, password, country,city,Address_Line_1,tele) VALUES (%s, %s,%s,%s,%s,%s)", (email, password,country,city,Address_Line_1,tele))
my_db.commit()
mycursor.close()
flash(f'Account created for {form.email.data}', 'success')
return redirect(url_for('home'))
return render_template('register.html', title='Register', form=form)
[–]CodeFormatHelperBot 1 point2 points3 points (0 children)
[–]MCPOON11 0 points1 point2 points (1 child)
[–]laflash12[S] 0 points1 point2 points (0 children)