Mysql Query returning vague error following appsmith syntax

Below I have copied screenshots of the web form, the query string, and the error message. I have tried looking through the appsmith tutorials and watched multiple videos of the insert function but for some reason I am receiving an error when clicking submit on my form.

All I am trying to do it insert the values that the user inputs in the the table on my db. If I could get some help with this that would be greatly appreciated.

Since I am a new user I am unable to add more than one image so below should be my query string and the error message below.

Hello and welcome to our community! Please add some round brackets for the values part in your query:
VALUES ('{{value1}}' , '{{value2}}' , '{{value3}}' , ...); and try to re-run the query. If you still get an error, share a new screenshot and also expand the requestParams part of the error to help us further debug it.

I added the Parenthesis and still I am receiving the same error. I tried to expand the requestParams as far as I could hopefully that helps.

Here is the code now:
insert into SJM_VisitorInfo (Fullname, Phonenumber, Company, purpose, Citizen, ITAR) values (‘{{FullName.text}}’,‘{{PhoneEmail.text}}’, ‘{{Company.text}}’, ‘{{Purpose.text}}’, {{RadioGroup1.selectedOptionValue}}, {{RadioGroup2.selectedOptionValue}});

It seems that in your MySQL database, the HostEmployeeNum is a mandatory column of your table. Could you please also insert a value for this one in your query?

That seemed to work. The issue now is that it only sends to my db when I turn the “Prepared Statement” off. This obviously isn’t something I can have disabled for security reasons.

So, now I need to figure out why the Prepared Statement is causing the insert to fail.

What is the data type of the column HostEmployeeNum in your database?

Hey Amelia,

I was able to fix this by removing the spaces that were added by default. This data source was adding spaces to the beginning to make the total characters 7 which helped my boss with management on our CRM system. I am not entirely sure why he needed this but he said he can work around it. I am able to upload the employee num without the spaces with no issue it was the spaces at the beginning that were throwing the code off.

Thanks for helping

1 Like