Category: Question and Answers
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Mysql Query returning vague error following appsmith syntax

Issue

I am having trouble inserting values from a web form into my MySQL database using Appsmith. At first, I was receiving a syntax error due to missing parentheses in my query string, but even after fixing that, I was still having issues inserting data with Prepared Statements enabled. Eventually, I realized that the spaces being added to my HostEmployeeNum column was causing the issue, and removing those spaces fixed the problem.

Resolution

The user was trying to insert data from a web form into a MySQL database table using Appsmith, but was receiving an error message when trying to submit the form. The error message indicated that the VALUES part of the query was incorrect and recommended adding parentheses to enclose the values. The user made this change, but still received the same error message.

The community suggested adding a value for the mandatory column HostEmployeeNum, which resolved the initial error. However, the user then encountered an issue where the insert statement failed when the Prepared Statement option was turned on.

After further investigation, it was found that the data source was adding spaces to the beginning of the HostEmployeeNum field, which caused the insert statement to fail. The user was able to fix the issue by removing the spaces and uploading the employee number without spaces in the front.

Overall, the solution involved ensuring that all fields in the insert statement had a value and avoiding any formatting or default settings that might interfere with the insertion process.