# How To get Variable name as value then store in in mysql dataabse

**URL:** <https://discourse.nodered.org/t/how-to-get-variable-name-as-value-then-store-in-in-mysql-dataabse/48229>\
**Category:** General\
**Created:** [10 July 2021 04:27 UTC](https://discourse.nodered.org/t/how-to-get-variable-name-as-value-then-store-in-in-mysql-dataabse/48229 "2021-07-10T04:27:18Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![muhammad\_mikail\_j](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@muhammad\_mikail\_j](https://discourse.nodered.org/u/muhammad_mikail_j)\
**Post date:** [10 July 2021 04:27 UTC](https://discourse.nodered.org/t/how-to-get-variable-name-as-value-then-store-in-in-mysql-dataabse/48229/1 "2021-07-10T04:27:18Z")

</div>

Hi All,

Nice to connect with people in this forum.  
I would like to make data logger with flow below,  
PLC (Data source) -\> Node-Red -\> MySql database.

I have store value to database with function below :  
msg.topic = "INSERT INTO inject\_testing (HOD\_Ozone) VALUES (" + msg.payload.HOD\_Ozone + ");";  
return msg;

The next purpose is to get variable name as value and store it in database, for example the variable name is "HOD\_Ozone" then I need to get "HOD\_Ozone" store it in other variable to be able store in db.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2ffbaafc641aaa860afc4a2bbe6be96b0a668fe.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/5007584bd60f5fca446e39225315a916f7bf49a9.png)

Anyone have experience in this case ?

Thank you 🙂

---

_[View the full topic](https://discourse.nodered.org/t/how-to-get-variable-name-as-value-then-store-in-in-mysql-dataabse/48229)._
