# Copying my Door control status back to my Mysql databse

**URL:** <https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383>\
**Category:** General\
**Created:** [20 July 2020 09:03 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383 "2020-07-20T09:03:04Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 07:40 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/61 "2020-07-21T07:40:34Z")

</div>

Lets take one e.g  
I have enterred E1234562 throught my mqtt code and by help of node red i am checking that E1234562 is stored or not if stored it shows and send string"CR\_SUCCESS" otherwise "CR\_FAIL".  
Now next step if E1234562 entered and it is valid also now that person wants to enter his/her room and by controlling switches he/she can close/open the door.  
Next step this Door\_Status (open or close) i want to update this status in my DataBase Column (my column name is Door\_Status).

In Summary i want a flow in which only ENTERED VALID rfid can only access Door Switches

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 08:06 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/62 "2020-07-21T08:06:56Z")

</div>

First of all, please realise that most of the people trying to help you are in the UK. So when you post at 7am our time, you are not going to get an instant response. Posting multiple times asking for help is not going to get an answer quicker.

Second, can I ask why are you building this solution at all? Is this a school/university assignment? Is it a personal project for some reason?

I have spent a huge amount of time trying to help you. I have tried to explain in detail each step we're going through. I have done that to try to give you the information you need to do this for yourself.

Unfortunately I'm not seeing any attempt by you to understand what I am writing. Whilst I can continue to try to help you, I am not going to be able to give you as much time today.

So, lets try to get to the point where you _understand_ what this flow is doing so you are able to debug it _yourself_.

In the most recent screenshot you have shared, you appear to have removed the `set msg.id` Change node from the flow. **Why have you done that?** We can just see in the Debug sidebar the message that arrived on the `Debug_rfid` node - the `topic` property shows the query you have tried to run:

```auto
UDPATE rfid1 Set Door_status='DR1_ON' WHERE rfidno='';

```

**Can you see the problem with that query?**

Answer:

```auto
rfidno=''

```

Now, I assume the Template node is configured as I suggested yesterday - with `WHERE rfidno='{{id}}'` in it. But as you have removed the Change node from the flow, then `msg.id` won't be set to anything.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 08:22 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/63 "2020-07-21T08:22:38Z")

</div>

Sir its my urgent project which i get know about node red ,its a great platform to deploy my flow.

ok you mean that i have to attached set.msg.id to template(in which updated query is written)

![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/138ae23e79ac4ce5c63a253fd36eaa5c8e679da5.png)

 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24b204f0f207c79786d713c3aac2a59febb2b9c0.png) ![3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f26c4f08b5113fd67ada58042a68f97cb0f7f84b.png) ![5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c98baf383737a0e471026dbc09908425c01ce98.png)  
Now I am attaching that screenshots,and output too.  
(

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 08:23 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/64 "2020-07-21T08:23:20Z")

</div>

Open should be updated on E1234562 person column

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 08:29 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/65 "2020-07-21T08:29:01Z")

</div>

Then you'll need to look at what SQL your flow is running and figure out what is going wrong. Sharing lots of screenshots won't make that happen.

You need to look at the SQL you are passing to the database node for yourself.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 08:30 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/66 "2020-07-21T08:30:58Z")

</div>

Sir SQL Query as you told like that only i have entered,then where i am wrong .Sorry for trouble as i need your help thats why i am asking

UPDATE rfid1  
SET Door\_Status='{{payload}}'  
WHERE rfidno='{{id}}';

I am not getting why id is showing blank like this

```auto
rfidno='' "

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 08:36 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/67 "2020-07-21T08:36:45Z")

</div>

> [@shipra](#):
>
> I am not getting why id is showing blank like this

If that is the output you are getting, then `msg.id` must be blank at the point the message is passed to the Template node. You need to figure out why that is. Use a Debug node to look at the message you are passing into the Template node. Confirm it has `msg.id`. Use a Debug node to look at the message coming out of the Template node. Keep debugging it until you get the right input and output.

I'm sorry, but if this really is urgent, you'd spend a bit more time reading the replies you are given and try to understand the help we're giving.

I'm going out now - I won't be replying to anything until later today. Read back through the full history of this discussion. Reread the information I have given you.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 08:39 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/68 "2020-07-21T08:39:11Z")

</div>

Sir i have putted the debug node too ,it is showing id:E1234562 but not passing that id to template i dont why it is happening.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 July 2020 09:12 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/69 "2020-07-21T09:12:31Z")

</div>

export your current flow and attach it to a reply.

Did you complete the mysql tutorial?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 09:18 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/70 "2020-07-21T09:18:01Z")

</div>

> [@zenofmud](#):
>
> Did you complete the mysql tutorial?

yes sir

> [@zenofmud](#):
>
> export your current flow and attach it to a repl

ok

```auto
7/21/2020, 2:43:52 PMnode: MQTT_IN DebugRFID : msg : Object
object
topic: "RFID"
payload: "E1234562"
qos: 1
retain: false
_msgid: "4f3bd9fe.f6c748"
7/21/2020, 2:43:52 PMnode: debug3RFID : msg : Object
object
topic: "RFID"
payload: "E1234562"
qos: 1
retain: false
_msgid: "4f3bd9fe.f6c748"
id: "E1234562"
7/21/2020, 2:43:52 PMnode: Debug23SELECT rfidno FROM rfid1 WHERE rfidno='E1234562'; : msg.payload : string[8]
"E1234562"
7/21/2020, 2:43:52 PMnode: Debug_templateUPDATE rfid1 SET Door_Status='E1234562' WHERE rfidno='E1234562'; : msg : Object
object
topic: "UPDATE rfid1 ↵SET Door_Status='E1234562'↵WHERE rfidno='E1234562';↵"
payload: "E1234562"
qos: 1
retain: false
_msgid: "4f3bd9fe.f6c748"
id: "E1234562"
7/21/2020, 2:43:52 PMnode: Debug2SELECT rfidno FROM rfid1 WHERE rfidno='E1234562'; : msg.payload : string[10]
"CR_SUCCESS"
7/21/2020, 2:43:52 PMnode: Debug_rfidUPDATE rfid1 SET Door_Status='E1234562' WHERE rfidno='E1234562'; : msg : Object
object
topic: "UPDATE rfid1 ↵SET Door_Status='E1234562'↵WHERE rfidno='E1234562';↵"
payload: object
qos: 1
retain: false
_msgid: "4f3bd9fe.f6c748"
id: "E1234562"
7/21/2020, 2:44:27 PMnode: Debug_templateUPDATE rfid1 SET Door_Status='DR1_ON' WHERE rfidno=''; : msg : Object
object
payload: "DR1_ON"
socketid: "0X1qahQGabD1HcmNAAAA"
_msgid: "def2d8c4.cb20d8"
topic: "UPDATE rfid1 ↵SET Door_Status='DR1_ON'↵WHERE rfidno='';↵"
7/21/2020, 2:44:28 PMnode: Debug_rfidUPDATE rfid1 SET Door_Status='DR1_ON' WHERE rfidno=''; : msg : Object
object
payload: object
socketid: "0X1qahQGabD1HcmNAAAA"
_msgid: "def2d8c4.cb20d8"
topic: "UPDATE rfid1 ↵SET Door_Status='DR1_ON'↵WHERE rfidno='';↵"

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 July 2020 09:22 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/71 "2020-07-21T09:22:13Z")

</div>

That is a very nice copy of your debug log, but what has that got to do with my request?

> [@zenofmud](#):
>
> export your current flow and attach it to a reply.

go to the hamburger menu and select the 'Export' option

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 09:23 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/72 "2020-07-21T09:23:19Z")

</div>

```auto
[{"id":"f4ce26f0.22055","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"ec3347d0.94006","type":"mqtt in","z":"f4ce26f0.22055","name":"","topic":"RFID","qos":"1","datatype":"utf8","broker":"f119edb0.e6ff1","x":110,"y":160,"wires":[["8f06369a.7fb86","c7068d53.104278","a9497623.eb7a78"]]},{"id":"386fc529.c39e9a","type":"mysql","z":"f4ce26f0.22055","mydb":"38417304.575e9c","name":"","x":410,"y":240,"wires":[["3b5df68b.3ef092"]]},{"id":"a9497623.eb7a78","type":"template","z":"f4ce26f0.22055","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"SELECT rfidno FROM rfid1 \nWHERE rfidno='{{payload}}';","output":"str","x":260,"y":240,"wires":[["386fc529.c39e9a","d1329fd6.f801a"]]},{"id":"3b5df68b.3ef092","type":"switch","z":"f4ce26f0.22055","name":"","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":240,"wires":[["69c0acd5.fcc094"],["951e3461.d81718"]]},{"id":"69c0acd5.fcc094","type":"change","z":"f4ce26f0.22055","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"CR_FAIL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":140,"wires":[["fc20bb4d.9f3b9","8f218188.f7c7d"]]},{"id":"951e3461.d81718","type":"change","z":"f4ce26f0.22055","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"CR_SUCCESS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":340,"wires":[["27049bf1.bb8dd4","fc20bb4d.9f3b9","207d854c.6e3b7a","b00f41b0.3c09e8"]]},{"id":"fc20bb4d.9f3b9","type":"mqtt out","z":"f4ce26f0.22055","name":"","topic":"MATCH","qos":"2","retain":"true","broker":"f119edb0.e6ff1","x":800,"y":240,"wires":[]},{"id":"b00f41b0.3c09e8","type":"ui_switch","z":"f4ce26f0.22055","name":"","label":"Open","tooltip":"","group":"ea12b474.8ed4d8","order":0,"width":"2","height":"2","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"DR1_ON","onvalueType":"str","onicon":"","oncolor":"green","offvalue":"--","offvalueType":"str","officon":"","offcolor":"red","x":990,"y":60,"wires":[["6780d94e.dee3f","81999de5.5133f"]]},{"id":"207d854c.6e3b7a","type":"ui_switch","z":"f4ce26f0.22055","name":"","label":"Close","tooltip":"","group":"ea12b474.8ed4d8","order":0,"width":"2","height":"2","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"DR1_OFF","onvalueType":"str","onicon":"","oncolor":"green","offvalue":"--","offvalueType":"str","officon":"","offcolor":"red","x":990,"y":120,"wires":[["81999de5.5133f","6780d94e.dee3f"]]},{"id":"6780d94e.dee3f","type":"ui_text","z":"f4ce26f0.22055","group":"59684e9b.60672","order":2,"width":0,"height":0,"name":"","label":"DOOR1","format":"{{msg.payload}}","layout":"row-spread","x":1220,"y":60,"wires":[]},{"id":"81999de5.5133f","type":"template","z":"f4ce26f0.22055","name":"update_template","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"UPDATE rfid1 \nSET Door_Status='{{payload}}'\nWHERE rfidno='{{id}}';\n","output":"str","x":1190,"y":160,"wires":[["15c8e7a2.fd3328","a9bdcf4.c362e3"]]},{"id":"15c8e7a2.fd3328","type":"mysql","z":"f4ce26f0.22055","mydb":"38417304.575e9c","name":"","x":1350,"y":220,"wires":[["42a36416.b6dfe4"]]},{"id":"8f06369a.7fb86","type":"debug","z":"f4ce26f0.22055","name":"MQTT_IN Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":290,"y":80,"wires":[]},{"id":"8f218188.f7c7d","type":"debug","z":"f4ce26f0.22055","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":60,"wires":[]},{"id":"27049bf1.bb8dd4","type":"debug","z":"f4ce26f0.22055","name":"Debug2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":420,"wires":[]},{"id":"eabc8767.4fabf8","type":"debug","z":"f4ce26f0.22055","name":"debug3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":500,"y":100,"wires":[]},{"id":"c7068d53.104278","type":"change","z":"f4ce26f0.22055","name":"","rules":[{"t":"set","p":"id","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":160,"wires":[["eabc8767.4fabf8","81999de5.5133f"]]},{"id":"d1329fd6.f801a","type":"debug","z":"f4ce26f0.22055","name":"Debug23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":400,"y":340,"wires":[]},{"id":"a9bdcf4.c362e3","type":"debug","z":"f4ce26f0.22055","name":"Debug_template","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1320,"y":340,"wires":[]},{"id":"42a36416.b6dfe4","type":"debug","z":"f4ce26f0.22055","name":"Debug_rfid","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1490,"y":160,"wires":[]},{"id":"f119edb0.e6ff1","type":"mqtt-broker","z":"","name":"RFID","broker":"tcp://mqtt.eclipse.org","port":"1883","clientid":"NCS_Client_02","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"2","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"38417304.575e9c","type":"MySQLdatabase","z":"","name":"","host":"127.0.0.1","port":"3306","db":"rfid","tz":""},{"id":"ea12b474.8ed4d8","type":"ui_group","z":"","name":"Door 1","tab":"45bf936.9ba396c","order":2,"disp":true,"width":"6","collapse":false},{"id":"59684e9b.60672","type":"ui_group","z":"","name":"Door Controller","tab":"45bf936.9ba396c","order":1,"disp":true,"width":"6","collapse":false},{"id":"45bf936.9ba396c","type":"ui_tab","z":"","name":" NCS_Door Controller Panel","icon":"door controller","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 09:23 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/73 "2020-07-21T09:23:44Z")

</div>

You have shared lots of Debug sidebar output.

In that output we can see lots of different SQL queries you are running:

```auto
 "UPDATE rfid1 SET Door_Status='E1234562' WHERE rfidno='E1234562';"

```

```auto
"UPDATE rfid1 SET Door_Status='DR1_ON' WHERE rfidno='';"

```

That tells us you are still not generating the right SQL statement to run.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 July 2020 09:30 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/74 "2020-07-21T09:30:09Z")

</div>

I want you to analyse your flow. Take a look and tell me what happens when the `MQTT-in` node receives a message. explain it in detail, node by node following each wire a msg would travel.

 ![Screen Shot 2020-07-21 at 5.30.34 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/039039476696956540ef52b36ab58e0b1310895c.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [21 July 2020 09:36 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/75 "2020-07-21T09:36:28Z")

</div>

Try using `rfid` instead of `id` and use that for the query. Perhaps `id` is interfering with the internals of node-red/node.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 09:36 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/76 "2020-07-21T09:36:30Z")

</div>

Sir whenever i am clicking open or close button from the UI Dashboard it is sending rfid='--'  
I have not hardcoded any E1234562

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 09:38 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/77 "2020-07-21T09:38:48Z")

</div>

I tried Sir.Same issue is coming

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 09:43 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/78 "2020-07-21T09:43:16Z")

</div>

@bakman2 I would not have suggested she use `msg.id` if it was going to cause issues. Please don't confuse matters.

@shipra this is the first time you have shown a flow that has the Dashboard buttons wired up. You now have two wires going into the Template node. That means it will get triggered when the initial MQTT message arrives (which is what I _thought_ you wanted), and it will also get triggered when the dashboard buttons are changed - and in that part of the flow `msg.id` will not be set so the Template does not generate the query you want.

So the question is - when exactly do you want the database to be updated? If you only want it updated when the dashboard button is clicked, then that should be the only path to the template node for updating the database.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [21 July 2020 09:44 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/79 "2020-07-21T09:44:26Z")

</div>

RFID:- Takes a RFID input from user for e.g me  
set.msg.payload:- it i shelping me to strore my RFID in some id variable  
template:- it is checking in my database that whether that entered RFID is present or not  
rfid:my database  
switch:to differentiate between bad rfid or good rfid  
set.msg.payload:sending user friendly string("CR\_SUCCESS or CR\_FAIL")  
MATCH:my mqtt out node for publishing CR\_SUCCESS/CR\_FAIL  
Open and Close:my dashboard switches  
update template:updating my database whenever switch gets a trigger

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 09:46 UTC](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383/80 "2020-07-21T09:46:15Z")

</div>

How does the scanning of an RFID tag relate to the dashboard buttons?

If a user scans their tag, are they then shown the dashboard to open/close the doors?

So is it right to say:

> When a dashboard button is pressed, it should update the database for whoever last scanned their RFID tag?

[Previous page](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383.md?page=3)

[Next page](https://discourse.nodered.org/t/copying-my-door-control-status-back-to-my-mysql-databse/30383.md?page=5)
