retrive the data

plz help me

How to retrieve the data from database(mysql)in dropdownlist to display the form in yii framework

category(id, name)

article(id, categoryId, title, text)

>>module administrator

>>model Category

>>model Article

>>crud Category administrator/Category

>>crud Article administrator/Article

in protected/modules/administrator/views/article/form.php

echo CHtml::activeDropDownList($model, 'categoryId', CHtml::listData(Category::model()->findAll(),'id','name'));



if I have category(id, name,desc) how can I display both, name and desc in activeDropDownList display?

Thank you.

I think I would use something like this

$models = findAllBySql('SELECT id, CONCAT(name, " - ", desc) AS name_desc FROM category');

echo CHtml::activeDropDownList(





(not tested)