Why my MySQL table gets an error in my flask app.
enter code here
from flask import Flask, render_template, request
import mysql.connector
app = Flask(__name__)
conn =mysql.connector.connect(host='localhost',
database='login',
user=' root',
password='')
cursor=conn.cursor()
@app.route('/')
def login():
return render_template('login.html')
@app.route('/register')
def register():
return render_template('register.html')
@app.route('/home')
def home():
return render_template('home.html')
@app.route('/login_validation' , methods = ['POST'])
def login_validation():
email = request.form.get('email')
password = request.form.get('password')
cursor.execute("SELECT * FROM 'user' WHERE 'email' LIKE () AND 'password' LIKE '()' "
.format(email,password))
user = cursor.fetchall()
print(user)
# return f'Your Inputed Email : {email} <br> Your Inputed Password : {password}'
if __name__ =='__main__':
app.run(debug=True)
when I fill my login form then show this error:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''user' WHERE 'email' LIKE () AND 'password' LIKE '()'' at line 1
note: I create a database table in XAMMP Mysql
So how I fix it?