Thread: PHP Question
View Single Post
Old 07-30-2009, 11:54 PM  
adulttemps
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: Brentwood,TN Heredia, Costa Rica
Posts: 320
PHP Question

I have the following function

PHP Code:
function categories () {
    
    
    
    
$res mysql_query('select category from content ORDER BY category');
    while(
$rows mysql_fetch_array($res)){
    
        
        
$a = array();
        
        foreach (
$rows as $row)
        {
        
$foo explode(','$row);

        
$a array_merge($a$foo);
        

        echo 
'<li><a href="/videos/'.$a[0].'" title="'.$a[0].'">'.$a[0].'</a></li>';
                
        }
    }    
    

It selects the categories out fine, but how do i get it to only display unique categories?

This prints each category everytime its listed in the db I cant use select distinct because some categories contain more than one category : example anal, amateur, blowjob
__________________
Hillipino Money with Cams
adulttemps is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook