I try to put all the info from msg.payload into a database.
I installed everthing and it works for me.
SQL connect. Datas are going in.
my function is:
msg.topic = "INSERT INTO dbasename(data1) VALUES ('"+msg.payload+"')";
return msg;
debug output:
INSERT INTO dbasename(data1) VALUES ('[object Object]') : msg.payload : Object
[object Object] are going into database but not the json datas
Could you please give me a advise regarding my funktion. I dont want to split the json file. I want to input the entire info.
Hello Zenofmud
thanks for your reply. My database info are:
10.3.18-MariaDB-0+deb10u1 - Debian 10
The dbase name ="dbasename"
there are 2 columns in it. 1. name is "timestamp" typ "timestamp"
the 2nd is named "data1" typ "text"
I administrate it with phpmyadmin
And I havnt take done this tutorial. But I watched several videos on youtube.
According to the first post the payload is a string, but that cannot be correct, it must be a javascript object. [Edit] By that I mean that if it were a string it would work, to get the error posted the payload must in fact contain an object.