Copying my Door control status back to my Mysql databse

Then you need to do some reading/research, as @zenofmud suggested, about database design and construction and then try out some really SIMPLE examples.

Ok Sir.
Thank You

I have done it please check .

and what is the sql statement you used to do the update?

UPDATE rfid1
set Door_Status='{{payload}}'
WHERE name='Shipra Nigam';

And what does the flow do if someone uses a different RFID?

that is where i am stucking ,i am searching and thinking how to do that,please help sir

Once again I am going to suggest you stop trying to solve this until after you have taken the sql tutorial.

yes Sir i am reading

Sir one query i have ,I am entering my rfid no like E1234561 which is valid i want to give only control to that RFID fr updating the database .please suggest .Sorry for troubling

Sir Please anyone help

@Shipra this is not instant messaging, it is a forum where people reply to messages in their free time.

If someone doesn't reply instantly you do not need to to keep asking - it just means we're all a bit busy doing other things.

Please explain in much more detail. Please use words rather than screenshots to explain what you would like to achieve. Describe the whole scenario you are trying to create.

1 Like

First of ol Sorry I will take care in future,
Thank you Sir,
I have 2 rfid in my database ,i have properly validate that with my database,
Now,if one person (like rfid E1234561) enters the room and switch off their home door lights then i want to update only that (E1234561) rfid to be updated,
i have tried but both RFID entries getting updated which is wrong

I am taking user input (rfid ) with a mqtt code now that flow i want to extend with this functionality

What SQL statement are you using to update the table?

UPDATE rfid1
set Door_Status='{{payload}}'
WHERE rfidno='E1234561';
which is giving me wrong ,for e.g if I am entering E1234562(USER2) in mqtt code,this user can update user 1 status i dont want this.

UPDATE rfid1
set Door_Status='{{payload}}'
WHERE rfidno='E1234561';

In your SQL you have hardcoded E1234561 - so it will always update the row for that id.

If you want it to only update the row that corresponds to the id received, you need to build the query to include that id.

You are already inserting msg.payload into the query to dynamically set the status. Do you have the ID of the user as a message property that you can use here? Do you understand what I mean by that?

From what I recall of the previous thread, you start with the ID in msg.payload but it gets overwritten when you do the database lookup.

In which case, I suggest you add a Change node after the MQTT node, at the start of the flow, configured to set to the value of msg.payload - you will then be able to use later on in the flow.

As ever, use the Debug node to understand what properties your messages have.

above this understood,but not this one ,Sorry sir please could you give me more hints

I have edited my previous reply to add some more detail.

I am struggling in this .I am not getting Sir