我的代码有什么问题,
with connect_db() as conn:
cursor = conn.cursor()
stmt = """INSERT INTO ip_records ip_address VALUES (%s)"""
try:
cursor.execute(stmt, (ip))
except mysql.connector.Error as err:
print err
return
我正在尝试将 ip 地址作为字符串插入 mysql 表。但我收到此错误:
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 'ip_address VALUES (192.168.11.111)' at line 1