We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Conflicts with column name that include an underscore

Hi if i try :

$model::find(array('conditions'=>"3_column LIKE '%Some%'", orderBy => '3_column'));

i got this :

'Syntax error, unexpected token IDENTIFIER(_column), near to ...

Any solution for use "_"(underscore) on find method ?


edited Feb '15

May be more of a MySQL issue with starting with a number. Definitely nothing to do with the underscore. Can you rename column, use column map alias as explained in the docs, or at least try backtics in query.

It might be a problem with the fact that the column starts with a number. Probably somewhere between your snippet there, and the query actually being sent to MySQL, your column name might get assigned to a PHP variable. PHP doesn't allow variables to start with a number, which may be causing your error.