Hi, I have a table named "order", when I user db_select or db_query to fetch data from this table, there will be errors.

PDOException: 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' at line 1: SELECT * FROM order; Array ( )

Something like that.

I know order is keyword of SQL. so we can't use "order" as our table name?

Thank you.

Comments

David_Rothstein’s picture

As far as I understand, reserved keywords shouldn't be used in Drupal (even if some databases will allow them with proper escaping) - see http://drupal.org/node/2497.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.