title: YII model ::: CGridView Search by specific attribute using criteria
body: <p>I am new in yii. I want to search by attribute (field name) from my model and need to view in view page or another page by zii.widgets.grid.CGridView. </p>
  
  <ol>
  <li>how can I create a search() function in model by findByAttribute()</li>
  <li>so that we can show the results by attribute  without any search </li>
  </ol>
  
  <p>here is my model function but it is not working.. :: ERROR Undefined variable: pp_requisitionno </p>
  
  <pre><code>    public function searchView()
  {
  
      $criteria=new CDbCriteria();
      $criteria-&gt;select= 'pp_requisitionno';
      $criteria-&gt;addSearchCondition('pp_requisitionno',$pp_requisitionno);
      $criteria-&gt;compare('pp_requisitionno',$this-&gt;pp_requisitionno);
      $criteria-&gt;condition = 'pp_requisitionno=:pp_requisitionno';
      $criteria-&gt;params = array(':pp_requisitionno'=&gt;Yii::app()-&gt;Request-&gt;Getpost('pp_requisitionno'));
      $model = Requisitiondt::model()-&gt;find();
      return new CActiveDataProvider($this, array(
          'criteria'=&gt;$criteria,
      ));
  }
  </code></pre>
  
  <p>Any help please...</p>