Newbie - trying to pass ID through form but seems to be adding a $

Hi,

Complete newbie here - doing a christmas project.
I'm following a tutorial to add/edit/delete/update records - using a very simple form.

My database is a PostgreSQL database - it's connected fine.
I'm trying to update and delete records - but, I get the following error:

select count(*) as "count" from "sectors" where "id" = $1 - invalid input syntax for type integer: "{"id":2,"sector_name":"","date_added":"2022-12-27T14:49:46.266Z","date_updated":"2022-12-27T14:49:46.266Z"}"

And it doesn't update or delete my record.
The method I am using is simply by passing the ID form the selected row in my table - but it semes to me, like somehow, it is adding a dollar sign ($) to the id it is passing - and, because it is expecting an integer - it is not liking it......

Perhaps someone can provide some guidance?

thanks!
Neil

Hey maillme - welcome to the community!

You're inputting an entire object, where as the query only expects an ID. If you replace {{ table_sectors.selectedRow.data }} with {{ table_sectors.selectedRow.data.id }}, it should work :-).

Jonathan

1 Like

Thank you jonathan..... I may have missed this in the tutorial - or the tutorial missed it.
Either way - seems obvious now. thank you!