Create An Array Of Only Field Values Returned By The Findall() Of Ar Class


I need to list out my data retrieved from db table in view as tabular format.I need an array on which i can use foreach and list data row wise in the table.should i use active record’s find all method or any other method to do it.if i use findAll() then pls give an example code which help me to understand how to iterate through the result returned by the findAll() and how to create an associative array containing all row of my result set.

I find this link very useful Link:

An easy way…

//assuming to get tbl_person(name,age)

    public function getPersonArray(){

            $oDbConnection = Yii::app()->db; 


            $oCommand = $oDbConnection->createCommand('

            	SELECT name,age from tbl_person



            $oCDbDataReader = $oCommand->queryAll(); 

            foreach ($oCDbDataReader as $result)   {



            return $PersonArray;