Is there a way to do something like insert into…where in mysql node.js
I am using postman to test my api and this is a post request.
when i put the request url in postman it should say
with the 1 being :id in my code
I want to execute this sql statement in my node.js
INSERT INTO food (userid, rating, fooditem) VALUES (?, ?, ?) WHERE productid=?'
productid is my :id
the foodid and timestamps are auto incremented
but it gives me
I have tried using
UPDATE food SET userid=? , rating=? , review=? WHERE productid=?
based off other posts I have found here, however nothing pops up in my table when i do this although it is not counted as an error in my code
What should I do?
you don’t use
WHERE to specify the
productid column, it should just be another column that you insert into.
INSERT INTO food (userid, rating, fooditem, productid) VALUES (?, ?, ?, ?)
Answered By – Barmar