0

error imageActually I am trying to create flask web application in which, I wanted to store my input values from html webpage into MySQL database, but am getting error as Not all parameters were used in the SQL statement when calling my insert function. Please find my code

import mysql.connector as conn

def insert_records(name,email,location,salary,band):
    con=conn.connect(host='localhost',user='root',password='my password',database="my database")
    cur=con.cursor()
    sql="""insert into emp1.emp(Name,Email,Location,Salary,Band) values (%s,%s,%s,%d,%s)"""
    val=(name,email,location,salary,band)
    cur.execute(sql,val)
    con.commit()
    con.close()

1 Answers1

1

You need to use %s for every argument per the documentation - they use %s for strings, integers, datetimes, etc.

https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-execute.html