Pergunta

I am trying to convert a large SQL query to Propel.

if I add

->where("ads_table.date>DATE_SUB(CURDATE(),INTERVAL ? DAY)", $interval)

to the query and set $interval to 30, the generated SQL looks like this:

AND ads_table.date>DATE_SUB(CURDATE(),INTERVAL '1970-01-01 01:00:30' DAY)

How do I get it to see the parameter as an int?

Foi útil?

Solução

Ok, I found the answer in the Propel docs (I know).

->where("ads_table.date>DATE_SUB(CURDATE(),INTERVAL ? DAY)", $interval, \PDO::PARAM_INT)

does the trick.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top