Problem with json in autocomplete

I am trying to use the autocomplete widget to fetch both the id and the name filed from my database through:




public function actionSearch() 

    {

        $res =array();

	if (isset($_GET['term'])) 

        {			

            $qtxt ="SELECT name, id FROM user WHERE name LIKE :name";

            $command =Yii::app()->db->createCommand($qtxt);

            $command->bindValue(":name", '%'.$_GET['term'].'%', PDO::PARAM_STR);

            $res =$command->queryColumn();

        }

	echo CJSON::encode($res);      

        Yii::app()->end();

    }






$this->widget('zii.widgets.jui.CJuiAutoComplete', array(

	'name'=>'test',

	'value'=>'',

	'source'=>$this->createUrl('user/search'),

	// additional javascript options for the autocomplete plugin

	'options'=>array(

                'showAnim'=>'fold',

                'select'=>'js:function( event, ui ) {                    

                    alert(ui.item.label);        

                }'

            

	),

));



The alert function outputs only the name of the selected input, but i want both the id and the name encoded in json. And at receiver side i need properly decoded on the select event to find the id to redirect the user to the correct page. How can i achieve this? Thanks.

Please check this comment.