How To Get Certain Data From Findall Result

Hi there,

I have a fairly basic question, I’ve used findall to get an array of users based on certain critera. How do I get certain pieces of data from the array?

Lets say I want to get the emails for those users how would I go about it?

Sorry for the basic question but I can’t seem to find the answer.

Thanks




$model= Model::model()->findAll($criterial);

echo $model->column_name; 



Not quite; findAll() returns an array:




$models = Model::model->findAll();


foreach ($models as $model)

{

  echo $model->column_name;

}



or use find().

yep, Keith is right.

find() returns an object;

findAll() returns an array of objects.