get relation data in yii foreach?

hi

i have data table name as LISTIN

this is relations of that model

public function relations()

{


	


	return array(			


		'package' => array(self::BELONGS_TO, 'Lookupstatus', 'Package_'),		


		'category' => array(self::BELONGS_TO, 'Categories', 'CategoryId'),


		


}

this is my select query

$lis_by=Yii::app()->db->createCommand("SELECT * FROM listings WHERE PhysicalCity = ".$location_name->PhysicalCity." AND PhysicalProvince = ".$location_name->PhysicalProvince." ")->queryAll();

foreach ($lis_by as $lis_val) {

echo $lis_val[‘CompanyName’];

}

how get package name & category name from related table

i added like this

echo $lis_val[‘package’][‘package_name’]; //package_name is name of Lookupstatus table field with i need

echo $lis_val[‘category’][‘category_name’]; //category_name is name of Categoriestable field with i need

 but its not working for me

Active Records and Database Access Objects cannot be mixed. The relations you define will work for Active Records, but not for Database Access Objects.

this might help you understand it better just go thru it

http://www.yiiframework.com/doc/guide/1.1/en/database.ar