Addcondition In Search() Using >= Or <=

Hi everyone, I’ve been looking for a solution to use >= and <= in search(), I’ve found lots of workarounds about like and others…

But I need to add 2 conditions in order to filter a data in search() method, I’ve tried:



$criteria->addCondition('t.f1 >= :f1','AND');


$criteria->addSearchCondition('f2 <= :f2','AND');


But it doesn’t work…

In SQL it would be :

where ... and t.f1>=X and t.f2<=X

Does anyone know anything about this?


Try the following:

Try that


$criteria->addCondition('t.f1 >= :f1'); // AND is the default anyway

$criteria->addCondition('f2 <= :f2');

$criteria->params = array(

    ':f1' => '1356994800', 

    ':f2' => '1388444400',




PS1 Generally, when you post that something doesn’t work, you should give more details

PS2 Is addSearchCondition in your original code a typo or on purpose?

THX!!!! it works! :D

How can I print the values that search() recieve?

Because I need to check something… I’ve tried with echo and other like using js alerts but I cant get the values…




echo "<script type='text/javascript'>




echo $f1;



How can I print them to check them????

Thx again!