Copying my Door control status back to my Mysql databse

I want to write and insert into a column (which is Door Status) ,it should be written as Door open /Door close back to mysql databse how to do that?Please help

So what have you tried so far?
What part are you having problems with?
Export your flow and paste it to a reply

Sir I have one column name Door Status i am taking user input from a switch i want this updated data feed back to my database.

@zenofmud please help Sir

I don't see anywhere you creating an sql update or attempting to do the update.
How are you going to identify which row in the database to update?


I have created it through terminal in mysql

So where - in your flow - are you creating the sql update statement and where are you running that command?

This is what i have done maybe its wrong ,please suggest

From what you have just added, I have to assume you do not have much experience with sql.

The statement will update every row in the database where 'Door_status = "NOT NULL" and I don't think that is what you want to do.

Might I suggest you take a MySQL tutorial (such as this one: https://www.w3schools.com/sql/) before you go any further.

Yes Sir as i am new to mysql and node red I want to learn ,i will see the document right now but in case i dont get anything help me .thank you


Now Sir check ones.

What do you think that statement will do?

You really need to take the SQL tutorial before trying to move forward.

Ok Sir.I am studying that doc

"Error: ER_NO_DEFAULT_FOR_FIELD: Field 'name' doesn't have a default value"

This Error is coming sir

If you want to use MySQL, you have to have some background in how to use it.
Stop trying to fix your flow until you have completed the tutorial! Then you will have a basic understanding of how to create an sql query to do what you want to do.

1 Like

Sir I am reading the Doc.
Thank You

I would also suggest you look at how you write a Date/Time (e.g. epoch value) to a database as I think you would want to record the time/date when the door was opened or closed.

Hello @dynamicdave SIr. Actually Sir i want to record my incoming data/update data for e.g(Door open) into my Door Status column in my DB

Well, if it was my project, I would have two columns.
One labelled status and one labelled epoch or time.

If you are unfamiliar with what 'epoch' is you could have a three column layout like this...

'status' 'date' 'time'

To keep it simple, all the columns could be defined as text.

In the 'status' column you could store the text string 'open' or 'close'.

Yes Sir i want to know how to write/insert open/close back into column name