Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Call For Unique Records

$
0
0
Hi need help!
in my table i have
dept
value
businesses
engineering
engineering
agriculture
businesses

now here's the situation I want it to display them without duplication! it should show 1 bus., 1 engr., and 1 agriculture.

//my view code
	
 $this->beginWidget('zii.widgets.CPortlet', array(
			'title'=>'Dept',
		));
			$listpage=dept::model()->findAll();
        foreach ($listpage as $listpage){
		 
            $models2 = dept::model()->findBypk($listpage->id);
			 
            $mysidebar[] = $models2->getAlldept();        
       
		}
		$this->widget('zii.widgets.CMenu',array(
			'items'=>$mysidebar,	
'htmlOptions'=>array('class'=>'operations'),			
		));



public function getAlldept() {
  
	  
   $sidebar =array('label'=>$this->dept_user, 'url'=>array('/dept/index', 'pid'=>$this->dept_user));
    return $sidebar;
 
}

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>