Ahmad A Bazadgha Ahmad A Bazadgha - 11 months ago 40
MySQL Question

error while runing a update query in doctrine

I am trying to run the following script using doctrine but am getting a error can you help me guys?

$menusQuery = Doctrine_Query::create()
->set('order', 'order-1');

and the error is:

exception 'Doctrine_Connection_Mysql_Exception' with message '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 'order = order' at line 1. Failing Query: "UPDATE menu_header SET order = order"'

thank you

Answer Source

order is a reserved word in mySQL. Adding backticks ` around the field name might help, but it would be better to change the column's name.