Advanced Search Not Working using CSqlDataProvider

Hello All, I am a beginner with Yii, While I was using a CSqlDataProvider in my view, I was not able to make use of my ‘filter’ in the CGridView

$this->widget(‘zii.widgets.grid.CGridView’, array(


     'dataProvider' =>new CSqlDataProvider($sql),

    //  'filter'=>$model,//Shows an error when I do this

Please, post your thoughts on this one.

Thank You.

We should take a look at the big picture, especially the SQL statement. But I suggest you CACtiveDataProvider with a advanced use of it possibilities. The use of SQL in a direct way must be avoid for getting a high quality code… Keep it so simple doesn’t mean a simple coding job… at all… keep communication bro…