Here is the question, how do you use msg.payload to provided values for INSERT SQL statement?
I am using a node-red-node-mysql
node. If I create a complete SQL INSERT statement, put it in msg.topic it works. For example:
INSERT table(`Me`, `You`) VALUES (`Good`, `Bad`);
But if I set msg.topic to:
INSERT table(Me
, You
) VALUES (?,?);
And msg.payload to:
['Good','Bad']
The INSERT fails. Parse error, that the SQL query has a syntax issue.
The issue is that the node documentation says this possible, and I see several google examples saying this is possible, but I can't get it to work.
I also tried to do
INSERT table(`Me`, `You`) VALUES (msg.payload[0], msg.payload[1]);
But I am sure something is not right with the above. I get an odd message about msg.payload[0] is not understood. Any suggestions welcome, thanks.