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