# Uploading data to a mySQL database

**URL:** <https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844>\
**Category:** General\
**Tags:** database\
**Created:** [7 December 2021 20:31 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844 "2021-12-07T20:31:31Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:17 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/21 "2021-12-08T19:17:37Z")

</div>

right thats what i did. I set the debug node to display the complete msg object but it is still showing this error:

```auto
"Invalid property expression: unexpected ' at position 4"

```

which is pretty strange because is shoeld be seeing the query in the msg.topic right?

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:18 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/22 "2021-12-08T19:18:58Z")

</div>

I did untill i changed my query to this thanks to the help of @shrickus

```auto
INSERT INTO algemeen
    (machine, persoon, status, overtime)
VALUES
(
    {{ flow.get('machine') }},
    {{ flow.get('persoon') }},
    {{ flow.get('statusGoed') }},
    {{ flow.get('overtime') }}
)

```

but i should not be getting permission denied errors because the users has all of the permisions.

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:24 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/23 "2021-12-08T19:24:16Z")

</div>

I can't try a new client as of right now because the server running on a server and not on my laptop

---

<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:** [8 December 2021 19:30 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/24 "2021-12-08T19:30:48Z")

</div>

> [@evanic14](#):
>
> ```auto
> INSERT INTO algemeen
> (machine, persoon, status, overtime)
> VALUES
> (
> {{ flow.get('machine') }},
> {{ flow.get('persoon') }},
> {{ flow.get('statusGoed') }},
> {{ flow.get('overtime') }}
> )
> 
> ```

The syntax for flow context is not correct for the template node. Try

```auto
INSERT INTO algemeen
    (machine, persoon, status, overtime)
VALUES
(
    {{flow.machine}},
    {{flow.persoon}},
    {{flow.statusGoed}},
    {{flow.overtime}}
)

```

> It is possible to use a property from the flow context or global context. Just use `{{flow.name}}` or `{{global.name}}` , or for persistable store `store` use `{{flow[store].name}}` or `{{global[store].name}}`

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:36 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/25 "2021-12-08T19:36:01Z")

</div>

right. well your solution seems to work a bit better but it is still giving me an syntax error for some reason:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b52269e47cc6fa54777b6338addc0af6a62f5847.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:** [8 December 2021 19:38 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/26 "2021-12-08T19:38:05Z")

</div>

Flow.persoon seems to be blank does it exist, the error seems to be the 2 commas in succession.

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [8 December 2021 19:38 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/27 "2021-12-08T19:38:46Z")

</div>

> [@evanic14](#):
>
> `persoon`

value is missing in the query

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:39 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/28 "2021-12-08T19:39:31Z")

</div>

well flow.persoon definitly exists but i removed it anyway. got a new error though:

```auto
"Error: ER_BAD_FIELD_ERROR: Unknown column 'S' in 'field list'"

```

---

<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:** [8 December 2021 19:40 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/29 "2021-12-08T19:40:38Z")

</div>

Should the strings be in quotes?  
[edit]

> [@evanic14](#):
>
> My query does not contain strings so thats unnecessary.

I see at least two strings in your query.

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [8 December 2021 19:41 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/30 "2021-12-08T19:41:31Z")

</div>

Yes must have "S-110-1"

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:47 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/31 "2021-12-08T19:47:27Z")

</div>

right so how do i do that?  
because this is my query

```auto
INSERT INTO algemeen
    (machine, persoon, status, overtime)
VALUES
    (
        {{flow.machine}},
        {{flow.statusGoed}},
        {{flow.overtime}}
    );

```

and this is the output im gettinh:

```auto
INSERT INTO algemeen
    (machine, persoon, status, overtime)
VALUES
    (
        ,
        ,
        
    );

```

so where should i put the `"`?

---

<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:** [8 December 2021 19:50 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/32 "2021-12-08T19:50:36Z")

</div>

First you need to confirm the flow context exists check in info pane under context . refresh the flow context and post here.

quotes go around strings

```auto
        '{{flow.machine}}',
        '{{flow.statusGoed}}',
        {{flow.overtime}}

```

and remove persoon from columns

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 19:56 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/33 "2021-12-08T19:56:22Z")

</div>

oh i'm dumb

`and remove persoon from columns`

i forgot to remove "persoon" -\_-

---

<div class="post-metadata">

**Author:** ![evanic14](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/evanic14/32/23480_2.png) [@evanic14](https://discourse.nodered.org/u/evanic14)\
**Post date:** [8 December 2021 20:10 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/34 "2021-12-08T20:10:57Z")

</div>

right it seems to work now. i'm going to need to experiment some more before i close this topic. But for now i'd like to thank all of you for the help i've gotten.

---

<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:** [6 February 2022 20:11 UTC](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844/35 "2022-02-06T20:11:08Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/uploading-data-to-a-mysql-database/54844.md?page=1)
