how can use "findAllByAttributes"

I have code to find a row with a column that I knew the value:


 $userid = Yii::app()->user->id;

        

		$models=useremail::model()->findAllByAttributes('ue_userid',$userid);

        echo $models->ue_id;

but I have error mess:


Invalid argument supplied for foreach()

??? what wrong ?

I solved it :) I’m wrong with statement:

it must be:


     findByAttributes(array('username'=>$this->username));

Hi,

My favored usage is as below




$found = YourModelClass::model()->findAllByAttributes(

	array(),

	$condition  = 'columnNameInDb = :someVarName AND columnNameInDb02 > :someVarName02',

	$params     = array(

		':someVarName' => $someVarNameValue, 

		':someVarName02' => $someVarNameValue02,

	)

);



Hope it helps,

Nam.