Multiple Values Id Instead Of Name How To Dynamically Display Db Values

Iam using dropdown option multiple values insert option based inserting db values ,now how can i id instead of name

display dynamically ,i also tryed explode and implode its only fetching first values of the field please see my code what is the wrong in my code in models

public function getcname()

    {





        


        $selected_values= explode(',',  $this->JobLocation); //35,80,

for($i=0;$i<count($selected_values);$i++){

&#036;d[&#036;i] = &#036;selected_values[&#036;i];


 &#036;d= explode(',', &#036;d[&#036;i]);

$d2= implode(",", $d);

return $d2;

}

    }      

and my gridview ciolumn field code

array(‘name’=>‘JobLocation’,‘value’=>’$data-> getcname()’),