i am using CodeIgniter and i have a problem with duplicated name.
This is my Model:
function displayCategory($id){
$this->db->distinct();
$this->db->select('category');
$this->db->where('avenu_id',$id);
$result = $this->db->get('personal_closest')->result_array();
return $result;
}
This is my Controller:
$shop['category'] = $this->personal_closest->displayAvenuCategory($id);
And this is the View:
<ul class="tag-list">
<?php foreach ($avenuadmin as $key => $value) { ?>
<li><a href="<?php echo base_url().'social/category/'.$value['category']; ?>"><i class="fa fa-tag"></i> <?php echo $value['category']; ?></a></li>
<?php } ?>
</ul>
I am using distinct() function to prevent duplicate but is not working and my output is:
ACCESSORIES, HOME, TECH, WHATCHES, TECH, TECH. I need to show just ACCESSORIES, HOME, TECH, WHATCHES.