# Error when entering data in Mysql

**URL:** <https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767>\
**Category:** General\
**Created:** [21 February 2022 20:09 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767 "2022-02-21T20:09:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [21 February 2022 20:09 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/1 "2022-02-21T20:09:22Z")

</div>

Hello everyone, I have a problem which I cannot solve, I am trying to enter some boolean data from the output of a Siemens LOGO8 into a mysql table, simply 1 or 0, but when executing the instruction I get the following error: Error: ER\_BAD\_FIELD\_ERROR: Unknown column 'undefined' in 'field list'

I attach the instruction that I am using, can someone help me?  
Greetings.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c74b7641d7343667378224fa33090314c282d55b.png)

NODE INSERT VALUE:  
msg.topic = "INSERT INTO SPTable (STARTD, STOPD, Cnt\_STARTD, Cnt\_STOPD) VALUES (" + flow.get("Q02") + "," + flow.get("Q05") + "," + flow.get("AM10") + "," + flow.get("AM11") + ")";  
return msg;

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc21e51aa3504af859755a15c1a48763bb9bb036.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/581097aaff38ba1b9055f234f34cca1ae7160e06.png)

I attach my table in mysql, the columns are configured to receive a boolean data and so that the columns could be observed, I added a value of 1 directly in mysql  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb9c8028a843db0517016482743822de7613eb17.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [21 February 2022 20:30 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/2 "2022-02-21T20:30:14Z")

</div>

The first column of your DB table is STARTe not STARTD

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 February 2022 20:31 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/3 "2022-02-21T20:31:25Z")

</div>

Put a debug before the mysql node & check the SQL string.

Also, look in the sidebar context tab, look at the values of flow context - do your flow variables have values?

---

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [21 February 2022 20:49 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/4 "2022-02-21T20:49:23Z")

</div>

Sorry if I was running multiple tests and attached the wrong image. It is definitely STARTD but it still gives me the error

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [21 February 2022 21:21 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/5 "2022-02-21T21:21:34Z")

</div>

Then follow Steve's advice.

Or is the table name correct as i see SPTABLE and SPTable, You may need to edit your post so everyone is working from the same page.

---

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [21 February 2022 22:51 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/6 "2022-02-21T22:51:48Z")

</div>

Thanks, I did it and I realized that the states of Q02 and Q05 were fine and what was giving me a problem was AM10 and AM11. I used those variables AM10 and AM11 as 2 outputs that registered how many times a motor stops, but the correct blocks that I should have used had to be analog outputs AQ. I changed it and it works. Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 March 2022 22:52 UTC](https://discourse.nodered.org/t/error-when-entering-data-in-mysql/58767/7 "2022-03-07T22:52:04Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
