Skip to content
Advertisement

Insert error in a Mysql query Flask web app

My app.py code :

JavaScript

This is the error I get :

JavaScript

I am using python 3.10.2 and flask 2.2.2 in my virtual environment. And I am using Visual Studio IDE. It seems like I am doing something wrong in the MYSQL query. can you guys tell me what am i doing wrong here.

Advertisement

Answer

You are missing a closing bracket in your cursor.execute() statement and the last comma is not needed. Also, you can specify the column names.

Here is a solution with the query and values separated into variables for readability:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement