Answer the question
In order to leave comments, you need to log in
How to display the number of (for example) vacancies next to the name of the city?
How to make such a thing: there is a list of cities and next to it you need to display the number of vacancies in this city
. For example: Moscow 34 (vacancies), St. Petersburg 23 (vacancies), etc. I wrote a sql query that displays the number of vacancies in the database by city id, but I don’t know how to describe it in yii
Request:
SELECT cityId, COUNT(*) FROM mnk_vacancy GROUP BY city_id
public function getCityList()
{
$cityList = $this->findAll(array('order' => 'name'));
$cityArray = CHtml::listData($cityList, 'id', 'name');
return $cityArray;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question