Server Error 500 During Search

Hello

I am Ashish Gupta.I am new in yii framework. I am doing a project where I am facing problem during search. I am sharing code for search action in model, gridview code and search form code. I am getting error (Error 500 <h1>PHP ERROR(8)use of undefined constant.).I am using drop down list for search which is based on foreign key relationship. In main table only numeric id going to store. Please help me to understand the error with solution.

My search function in model class

public function search()

{


	// @todo Please modify the following code to remove attributes that should not be searched.





	&#036;criteria=new CDbCriteria;





	&#036;criteria-&gt;compare('fname',&#036;this-&gt;fname,true);


	&#036;criteria-&gt;compare('lname',&#036;this-&gt;lname,true);


	&#036;criteria-&gt;compare('username',&#036;this-&gt;username,true);


	&#036;criteria-&gt;compare('password',&#036;this-&gt;password,true);


	&#036;criteria-&gt;compare('email',&#036;this-&gt;email,true);


	&#036;criteria-&gt;compare('status_id',&#036;this-&gt;status_id,true);


	&#036;criteria-&gt;compare('pkg_id',&#036;this-&gt;pkg_id,true);


	&#036;criteria-&gt;compare('active_date',&#036;this-&gt;active_date,true);


	&#036;criteria-&gt;compare('deactive_date',&#036;this-&gt;deactive_date,true);





	return new CActiveDataProvider(&#036;this, array(


		'criteria'=&gt;&#036;criteria,


	));


}

my view file which display gridview formate

<?php

/* @var $this AdminUserController */

/* @var $model AdminUser */

$this->breadcrumbs=array(

'Admin Users'=&gt;array('index'),


'Manage',

);

$this->menu=array(

array('label'=&gt;'List AdminUser', 'url'=&gt;array('index')),


array('label'=&gt;'Create AdminUser', 'url'=&gt;array('create')),


array('label'=&gt;'Manage AdminUser Contact', 'url'=&gt;array('adminUserContact/admin')),

);

Yii::app()->clientScript->registerScript(‘search’, "

$(’.search-button’).click(function(){

&#036;('.search-form').toggle();


return false;

});

$(’.search-form form’).submit(function(){

&#036;('#admin-user-grid').yiiGridView('update', {


	data: &#036;(this).serialize()


});


return false;

});

");

?>

<h1>Manage Admin Users</h1>

<p>

You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>

or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.

</p>

<?php echo CHtml::link(‘Advanced Search’,’#’,array(‘class’=>‘search-button’)); ?>

<div class="search-form" style="display:none">

<?php $this->renderPartial(’_search’,array(

'model'=&gt;&#036;model,

)); ?>

</div><!-- search-form -->

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

'id'=&gt;'admin-user-grid',


'dataProvider'=&gt;&#036;model-&gt;search(),


'filter'=&gt;&#036;model,


'columns'=&gt;array(


	'fname',


	'lname',


	'username',


	'password',


	'email',


	array('name'=&gt;'status_id','value'=&gt;CHtml::encode(&#036;model-&gt;getStatusText())),


	array('name'=&gt;'pkg_id','value'=&gt;CHtml::encode(&#036;model-&gt;getPackageText())),


	'active_date',


	'deactive_date',


	


	array(


		'class'=&gt;'CButtonColumn',


	),


),

)); ?>

my search form code which will load by ajax function when advance search is clicked

<?php

/* @var $this AdminUserController */

/* @var $model AdminUser */

/* @var $form CActiveForm */

?>

<div class="wide form">

<?php $form=$this->beginWidget(‘CActiveForm’, array(

'action'=&gt;Yii::app()-&gt;createUrl(&#036;this-&gt;route),


'method'=&gt;'get',

)); ?>

&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'fname'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'fname',array('size'=&gt;60,'maxlength'=&gt;255)); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'lname'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'lname',array('size'=&gt;60,'maxlength'=&gt;255)); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'username'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'username',array('size'=&gt;60,'maxlength'=&gt;255)); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'email'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'email',array('size'=&gt;60,'maxlength'=&gt;255)); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'status_id'); ?&gt;


	&lt;?php //echo &#036;form-&gt;textField(&#036;model,'status_id');


			echo &#036;form-&gt;dropDownList(&#036;model,'status_id',&#036;model-&gt;getStatusOption());


	 ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'pkg_id'); ?&gt;


	&lt;?php //echo &#036;form-&gt;textField(&#036;model,'pkg_id');


			echo &#036;form-&gt;dropDownList(&#036;model,'pkg_id',&#036;model-&gt;getPkgOption());


	 ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'active_date'); ?&gt;


	&lt;?php //echo &#036;form-&gt;textField(&#036;model,'active_date'); 


			&#036;this-&gt;widget('zii.widgets.jui.CJuiDatePicker',array(


			


		   'model' =&gt; &#036;model,


			'attribute' =&gt; 'active_date',


			


// additional javascript options for the date picker plugin


		 	'options'=&gt;array(


  		 


  		  					'dateFormat' =&gt; 'yy-mm-dd',     // format of &quot;2012-12-25&quot;


   							'showOtherMonths' =&gt; true,      // show dates in other months


  							'selectOtherMonths' =&gt; true,    // can seelect dates in other months


  							'changeYear' =&gt; true,           // can change year


  							'changeMonth' =&gt; true,  


  							'yearRange'=&gt;'2014:2050',   


		  				 ),


			'htmlOptions'=&gt;array(


    								'style'=&gt;'height:20px;',


    								


		 						 ),


		));


	?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'deactive_date'); ?&gt;


	&lt;?php //echo &#036;form-&gt;textField(&#036;model,'deactive_date'); 


		&#036;this-&gt;widget('zii.widgets.jui.CJuiDatePicker',array(


			


		   'model' =&gt; &#036;model,


			'attribute' =&gt; 'deactive_date',


// additional javascript options for the date picker plugin


		 	'options'=&gt;array(


  		 


  		  					'dateFormat' =&gt; 'yy-mm-dd',     // format of &quot;2012-12-25&quot;


   							'showOtherMonths' =&gt; true,      // show dates in other months


  							'selectOtherMonths' =&gt; true,    // can seelect dates in other months


  							'changeYear' =&gt; true,           // can change year


  							'changeMonth' =&gt; true,  


  							'yearRange'=&gt;'2014:2050',   


		  				 ),


			'htmlOptions'=&gt;array(


    								'style'=&gt;'height:20px;'


		 						 ),


		));


	?&gt;


&lt;/div&gt;





&lt;div class=&quot;row buttons&quot;&gt;


	&lt;?php echo CHtml::submitButton('Search'); ?&gt;


&lt;/div&gt;

<?php $this->endWidget(); ?>

</div><!-- search-form -->

Fetching text from the table for display purpose.

public function getStatusText()

{


	&#036;user=Status::model()-&gt;findByAttributes(array('statusid'=&gt;&#036;this-&gt;status_id));


	return &#036;user['status_name'];


}


public function getPackageText()


{


	&#036;user=Package::model()-&gt;findByAttributes(array('pkgid'=&gt;&#036;this-&gt;pkg_id));


	return &#036;user['pkg_name'];


}

Fetching options from the table.

public function getPkgOption()

{


	&#036;models = Package::model()-&gt;findAll();


	&#036;list = CHtml::listData(&#036;models,'pkgid', 'pkg_name');


	return &#036;list;


}


public function getStatusOption()


{


	&#036;models = Status::model()-&gt;findAll();


	&#036;list = CHtml::listData(&#036;models,'statusid', 'status_name');


	return &#036;list;


}

Pleas make me understand the error and solution for the error.

You don’t seem to have uploaded a screen shot.