Node Red reading state

Hello people. i’m brand new in node-red and need to understand how the messages work. I use HA nodes and collect data from 2 entities (temp + humy) with 2 nodes “current state” , which is fine. I have my values for T&H. After that i want to use function , which have to put my data in MySQL and prepare it :

msg.topic = "INSERT into alibaba (time,location,temp,humidity) values (now(),'bathroom','" + msg.temp.state +"','" + msg.humy.state + "');" 

, but give me error, that can’t read the state. When I try to use only msg.humy.state or msg.temp.state it return me correct value. Where i do mistake ?