error

Fatal error: Call to undefined method CDbCriteria::compare() in C:\xampp\htdocs\tirocini\protected\models\anagrafe.php on line 134




public function search()

	{

		// Warning: Please modify the following code to remove attributes that

	

		

		

	

		$criteria=new CDbCriteria;


		$criteria->compare('NOME',$this->NOME,true);


		$criteria->compare('ANAGRA_ID',$this->ANAGRA_ID);


		//$criteria->compare('E_MAIL',$this->E_MAIL,true);


		//$criteria->compare('INDIRIZZO',$this->INDIRIZZO,true);


		//$criteria->compare('NOTE',$this->NOTE,true);


		//$criteria->compare('TELEFONO_3',$this->TELEFONO_3,true);


		//$criteria->compare('CODICE_FISCALE',$this->CODICE_FISCALE,true);


		//$criteria->compare('TELEFONO_1',$this->TELEFONO_1,true);


		//$criteria->compare('SESSO',$this->SESSO,true);


		$criteria->compare('COGNOME',$this->COGNOME,true);


		//$criteria->compare('DATA_NASCITA',$this->DATA_NASCITA,true);


		//$criteria->compare('TELEFONO_2',$this->TELEFONO_2,true);


		//$criteria->compare('COMUNE_COMUNE_ID',$this->COMUNE_COMUNE_ID);


		//$criteria->compare('COMUNE_COMUNE_ID_NASCE',$this->COMUNE_COMUNE_ID_NASCE);


		//$criteria->compare('CAP',$this->CAP,true);


		//$criteria->compare('DOMICILIO',$this->DOMICILIO,true);


		//$criteria->compare('CAP_DOM',$this->CAP_DOM,true);


		//$criteria->compare('COMUNE_COMUNE_ID_DOMICILIA',$this->COMUNE_COMUNE_ID_DOMICILIA);


		//$criteria->compare('ACCESSO_PORTAL',$this->ACCESSO_PORTAL,true);


		//$criteria->compare('STATO_CIVILE',$this->STATO_CIVILE,true);


		//$criteria->compare('FAX',$this->FAX,true);


		//$criteria->compare('CELLULARE',$this->CELLULARE,true);


		//$criteria->compare('CITTADINANZA',$this->CITTADINANZA,true);


		 return new CActiveDataProvider('ANAGRAFE', array(

			'criteria'=>$criteria,

		));



Can you help me???

Maybe my version has no class CDbCriteria…

Can I replace it with another?

What version of Yii are you using?

CDbCriteria::compare() is available from Yii 1.1.1 - http://www.yiiframework.com/doc/api/CDbCriteria#compare-detail

I have a version 1.1.1 i have download yii-1.1.1.r1907

try with


CDbCriteria->addcondition("NOME like '%{$this->NOME,true}%'");

it should to the same stuff of compare()

I get an error after the decimal point and the true…what i can do?????

remove “,true” so that you have ‘%{$this->NOME}%’

ops, sorry kitty10, I mistoke writing you the advice.

Of corse this ",true" is a copy-paste mistake.