We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

SQL Query Execution in PHQL

SELECT * FROM table_name WHERE created_at = "2016-01-26" ORDER BY CAST(change AS SIGNED INTEGER) ASC LIMIT 5;

To use raw sql queries you should take a look here: https://docs.phalcon.io/en/latest/reference/phql.html#using-raw-sql

Phalcon Query Builder requires you to use models and not table names.



85.5k

i think its because change is reserved word https://dev.mysql.com/doc/refman/5.5/en/keywords.html

try:

CAST([change] AS ... )

Doesn't phalcon support "CAST" keyword.

By the way I got the array from mysql and make php array and use php casting method and use multisort function to sort array.