How to get data from MYSQL

hello, my name is Arwin, I want to retrieve data in my MySQL database, but the results are like that? how to take only the values ​​at the "suhu" only? thank you
my Query

msg.topic = "SELECT suhu FROM ph ORDER BY timestamp DESC LIMIT 1";

Prob1

i want the UI Text to be "Suhu : 0", is there any suggestion for me?

The first thing to do in a situation like this is to add a debug node to see what information is coming from the database node. Then you need to work out how to extract the particular data that you need.


This is my debug from MySQL node

Hover your mouse over the object and you will see some options.
Screen Shot 2020-12-16 at 4.51.46 AM
Clicking on the >_ will copy the path to the item
payload[0].suho
which you can use to access that item

In particular, for a ui text node you can put in the Value Format field
{{msg.payload[0].suho}}

its work, but if I add the data "suhu" then the data in the UI Text will not update. How can I update the data?

if I have 2 data, how do I make the UI Text update automatically? does not change the payload [0].suhu to payload [1].suhu

Again the first thing to do is to send the data to a debug node and see what is there.

@marwinwijaya

how do you get two outputs when you have a 'LIMIT 1' in your sql statement? Or have you changed the statement? Changing the SQL is important information to let us know

Thanks you, @Colin! @zenofmud

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.