Not all parameters were used in the SQL statement (Python, MySQL)

后端 未结 3 1526
一个人的身影
一个人的身影 2020-11-29 06:03

I get an error on the following Python code:

import mysql.connector
cnx = mysql.connector.connect(user=\'root\', password=\'\',
                          hos         


        
3条回答
  •  暖寄归人
    2020-11-29 07:07

    add_user = '''("INSERT INTO DB.tbluser " "(username, department, startyear, currentpos, link) " "VALUES (%s, %s, %s, %s, %s)")'''

    => you are using multi line statement so use triple single quotation marks here and use %s to represent passing value as string then that will works because %d is not supported by mysql to pass value

提交回复
热议问题