# SQL Error when saving

**URL:** <https://discourse.cakephp.org/t/sql-error-when-saving/4956>\
**Category:** Need Help\
**Created:** [September 19, 2018, 6:57pm UTC](https://discourse.cakephp.org/t/sql-error-when-saving/4956 "2018-09-19T18:57:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhall](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jhall](https://discourse.cakephp.org/u/jhall)\
**Post date:** [September 19, 2018, 6:57pm UTC](https://discourse.cakephp.org/t/sql-error-when-saving/4956/1 "2018-09-19T18:57:31Z")

</div>

Can anyone shed some light on why this error is happening? Is it because the column DESC is similar to a keyword for Descending in an order by?

**Error:** SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DESC = ‘test’ , modified = ‘2018-09-19 18:53:01’ WHERE id = 1266’ at line 1

---

<div class="post-metadata">

**Author:** ![bird](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/bird/32/1157_2.png) [@bird](https://discourse.cakephp.org/u/bird)\
**Post date:** [September 19, 2018, 7:22pm UTC](https://discourse.cakephp.org/t/sql-error-when-saving/4956/2 "2018-09-19T19:22:07Z")

</div>

> [@jhall](#):
>
> it because the column DESC is similar to a keyword for Descending in an order by?

[https://dev.mysql.com/doc/refman/8.0/en/keywords.html](https://dev.mysql.com/doc/refman/8.0/en/keywords.html)

---

<div class="post-metadata">

**Author:** ![jhall](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jhall](https://discourse.cakephp.org/u/jhall)\
**Post date:** [September 19, 2018, 7:41pm UTC](https://discourse.cakephp.org/t/sql-error-when-saving/4956/3 "2018-09-19T19:41:34Z")

</div>

Yes that was the issue I just went ahead and changed DESC to DESCRIPTION and that fixed the issue.

---

<div class="post-metadata">

**Author:** ![bird](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/bird/32/1157_2.png) [@bird](https://discourse.cakephp.org/u/bird)\
**Post date:** [September 19, 2018, 7:51pm UTC](https://discourse.cakephp.org/t/sql-error-when-saving/4956/4 "2018-09-19T19:51:50Z")

</div>

if you encounter this “problem” more often remember that you can also escape table and column names with backticks. ex.:

```auto
SELECT * FROM table WHERE `DESC` = 'test'

```

[https://dev.mysql.com/doc/refman/5.7/en/identifiers.html](https://dev.mysql.com/doc/refman/5.7/en/identifiers.html)
