I am trying to execute a query like this:
Select * from table where created_at > DATE_SUB(NOW(), INTERVAL 1 DAY)
in phalcon model query form. But i keep getting the following error:
Syntax error, unexpected token INTEGER(1), near to ' DAY)',
By query building is like below
$donations = Donations::query()
->where('created_at > DATE_SUB(NOW(), INTERVAL 1 DAY)')
->execute();
The above code gives me that error. Now i have tried like below
$donations = Donations::query()
->where('created_at > :holder:')
->bind(["holder" => 'DATE_SUB(NOW(), INTERVAL 1 DAY)'])
->execute();
Although this binding does not give me an error, it gives me a 0 result but i have a few rows inserted into the table to check this and when i execute the query in phpmyadmin it works correctly, So i assumed there might be a datetime mix up in the phalcon library setup of mine but when i changed from 1 DAY
to 1 MONTH
there is still not result. Can someone guide me on this.