# MySQL Not Updating

**URL:** <https://forum.inductiveautomation.com/t/mysql-not-updating/72085>\
**Category:** Ignition\
**Created:** [April 5, 2023, 1:40pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085 "2023-04-05T13:40:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Fuglsby](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nicholas\_Fuglsby](https://forum.inductiveautomation.com/u/Nicholas_Fuglsby)\
**Post date:** [April 5, 2023, 1:40pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/1 "2023-04-05T13:40:39Z")

</div>

I am having troubles with changing a value in table to update MySQL. I run the following cellEdited script. It will look like it takes after I hit enter. However, after a few seconds it will change back and not update MySQL table to reflect the change I want. I don't get any errors and database table is correct. (test\_locationn). I am trying to change Completed column and specific row from "N" to "Y". Thank you for any help.

Completed = event.source.data.getValueAt(event.source.selectedRow, 'completed')

headers = system.dataset.getColumnHeaders(event.source.data)

query = "UPDATE test\_locationn SET %s = ? WHERE Completed = ?" %(headers[event.column])  
args = [event.newValue, Completed]

system.db.runPrepUpdate(query, args)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 5, 2023, 1:46pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/2 "2023-04-05T13:46:10Z")

</div>

Try adding a refresh:

```python
system.db.refresh(event.source, "data")

```

---

<div class="post-metadata">

**Author:** ![Nicholas\_Fuglsby](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nicholas\_Fuglsby](https://forum.inductiveautomation.com/u/Nicholas_Fuglsby)\
**Post date:** [April 5, 2023, 2:05pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/3 "2023-04-05T14:05:51Z")

</div>

I have added that and it won't even look like it is trying to take. I just switches back to "N" Right Away

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 5, 2023, 2:08pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/4 "2023-04-05T14:08:50Z")

</div>

Does running the query directly in MySQL Workbench work? Perhaps there's a trigger you're unaware of that is setting the value back AFTER UPDATE or something.

---

<div class="post-metadata">

**Author:** ![Nicholas\_Fuglsby](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nicholas\_Fuglsby](https://forum.inductiveautomation.com/u/Nicholas_Fuglsby)\
**Post date:** [April 5, 2023, 2:55pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/5 "2023-04-05T14:55:02Z")

</div>

I entered this into my MySQL and worked:  
UPDATE test\_locationn SET Completed = 'Y' Where ndx = 47;

It is updating in MySQL but still not on Ignition.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 5, 2023, 2:55pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/6 "2023-04-05T14:55:51Z")

</div>

Your original query is `WHERE completed` not `WHERE ndx`

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 5, 2023, 3:39pm UTC](https://forum.inductiveautomation.com/t/mysql-not-updating/72085/7 "2023-04-05T15:39:16Z")

</div>

Did you try @JordanCClark's suggestion?

What does the binding on the table look like? Is polling set up or is it just static?
