CDbCriteria addBetweenCondition with param binding?

Hi!

I’m trying to use addBetweenCondition together with parameter binding (for security), but I can’t make it work…

I have a CDbCriteria and want to do something like this:




   $criteria->addBetweenCondition('startdate', ':loadFrom', ':loadTo');

   $criteria->params=array(':loadFrom'=>$loadFrom, ':loadTo'=>$loadTo);    



…but adding in the above gives me instant Error: bind or column index out of range.

This works:


$criteria->addBetweenCondition('startdate', $loadFrom, $loadTo);

Is perhaps addBetweenCondition already doing parameter binding automatically?

I checked the source, it binds automatically.

That’s great! Thanks for fast reply :)

I use addBetweenCondition to get date between date. But I only get result from datefrom and dateto. how can I use this to get other date?

For example I $datefrom= 01-04-2015 and $dateto= 05-04-2015. It only shows the result of $datefrom and $dateto and there’s no result from date between them. how can I fix this?

Thank you.