Hey All,
Just wondering if you can help me out.
I have a column with rows of tags. In each row i have each tag separated with a comma and space.
for example: BMW M5, Leather Seats, 24 Inch Wheels, etc.
What i need to do is loop through the array, explode it, and then print the values to the page. So far I have been able to do it; however, it prints the duplicates.
Here is the code i have so far:
<?php
$cleanTags = ($row_getTags['tags']);
$cleanerTags = str_replace(', ',"-",$cleanerTags);
$tagstr = ($cleanerTags);
$tags = explode('-',$tagstr);
foreach($tags as $tag)
{
echo "<li><a href=\"results.php?search=".str_replace(" ",'%20',$tag)."\" title=\"Find more stuff tagged: ".$tag."\" class=\"tagLink\">".$tag."</a></li>";
}
?>
How can I go about removing duplicates from the array? I've tried array_unique with no luck. Any help would be greatly appreciated and I thank you in advance for your help!!!
Cheers