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

PHQL Syntax error on MySQL Function ADDDATE or DATE_ADD

Hi guys I am getting syntax error on PHQL query while I can get result when I directly run it in MySQL..

    Syntax error, unexpected token INTEGER(1), near to ' DAY) WHERE F.fId= '2' AND T.tId = '1' ', when parsing: SELECT F.* FROM App\Models\FTable AS F INNER JOIN App\Models\TTable AS T ON F.startDate = ADDDATE(T.endDate,INTERVAL 1 DAY) WHERE F.fId= '2' AND T.tId = '1'

Hey, im pretty sure you have to use mysql built in functions this way: https://docs.phalcon.io/en/latest/api/Phalcon_Db_RawValue.html

Without your php code thats my best guess :)



8.4k

tnx.. the thing is, it's been simplified by me.. it s going to use dynamic INTERVAL DAY as paramater. so how can I use this in this situation even now!?

Hey, im pretty sure you have to use mysql built in functions this way: https://docs.phalcon.io/en/latest/api/Phalcon_Db_RawValue.html

Without your php code thats my best guess :)

Can you show us your php code?