Custom Query - Undefined binding(s) detected for keys


I’m trying to write a custom query to “Insert into” a SQL table. However, I’m having trouble getting the parameters to work properly. As I try to bind the post parameters to the SQL query, it’s giving me errors - see below example.

However, I can somehow make it work when there is only one parameter/binding in my custom insert SQL query - see below (the error is only there because timestamp is a required field, but it does recognise the parameter):

I’ve tried other combinations of parameters but I just can’t make the full insert query work (I do need to use a custom query for my insert, as I’m intending to nest queries).

Is this a bug, or am I doing something wrong? Appreciate any help, thanks!

Sounds like $_POST.legal_name doesn’t exist (= undefined). Try this:


See what gets inserted in the DB

Thanks @Apple. In that case “Empty” gets inserted as the value. How do I define $_POST.legal_name then? I’ve given the name “legal_name” to the Wappler text input that it relates to. This works to bind it as a parameter for a usual “Insert” query, but seems like it doesn’t for a custom query.


You should double check your HTML form, you can also open your browser’s developer tools to inspect if such parameter is being sent

Thanks a lot for your help so far - it has helped narrow down the issue at least!

I’ve tried looking into the HTML and am stuck again! I even set up a very simple test page with just one input on it named legal_name - see full HTML below:

I connected the form in the new test HTML/ejs page to the custom query “testtest” - see screenshot of the json custom query below:

However, running this and trying to submit the form shows that the legal_name post parameter is still not coming through - see screenshot of error message below:

I’m wondering… is custom query just not set up to accept post parameters? Not sure how it could be a problem with the HTML seeing as I’ve now set up a test page with such minimal scripting (unless there is something I’ve missed of course!)

Really appreciate your help! Let me know if there is any more info/screenshots I can provide to help with troubleshooting this issue. :slight_smile:


Seems a bit weird. Anyway, see this post in the middle, starting where it says “In your browser, open the Developer tools”:

Edit: The goal with the developer tools network tab is to see what fields your browser is sending, it’s slightly different from the screenshots in the topic above


Sorry, I missed the last screenshot of yours. Sounds like you’re having an unrelated issue! :thinking:

Field 'id' doesn't have a default value

Can you double-check your table schema and check if the column “id” is an auto-increment integer?


1 Like

Thanks so much @Apple! I tried again using the simplified version with a newly set up and simplified SQL table, and it worked… so it must be something to do with my existing table/HTML setup that’s causing it to not work.

Massive thanks for helping me debug it… think I can probably work it out from here by breaking it down further :slight_smile: you’re a champ

1 Like