CActiveDataProvider params and ILIKE Operator

I have a problem with the params attribute for CActiveDataProvider, when working with the LIKE and ILIKE operators in postgres:

        $provider = new CActiveDataProvider( 'Member',


                'criteria' => array(

                    'select'    => "id,last",          

                    'condition' => "last ILIKE %:filter%",

                    'params'    => array( ':filter' => 'sam' )




I’ve tried various permutations, with quotes and without, but keep getting SQL errors.

Any ideas?



I think the problem is in the %:filter%… try to leave it as %filter and then in ste ‘params’ you assign ‘:filter’=>’%sam%’

Thank you! That worked, and was better than my workaround, which was “last ILIKE ‘%’||:filter||’%’”. Don’t know why I didn’t think of your solution in the first place; it makes much more sense.