I have 2 tables, servers and ip, in ip table I am saving server_id
.
Now I want to show on server listing page how many total ips related to one server?
MY Server model code:
class Server extends CActiveRecord {
public function relations(){
return array('ipmodel'=>array(self::BELONGS_TO, 'IpManager', 'server_id'),
);
}
}
My CGridView Code:
array(
'header' => 'IP Count',
'value' => 'count($data->ipmodel)',
),
It is showing only 1 but there are so many ips against to one server! How I can do this?