Hi Ahmed,

hope this helps:

$ary = array() ;
$sql = "SELECT COUNT(*), category FROM movies GROUP BY category" ;
$res = mysql_query ( $sql ) ;

while ( $line = mysql_fetch_assoc ( $res ) ) {
    $ary[] = $line[ 'category' ] ;
}

echo implode ( " - " , $ary ) ;

 -- red

Ahmed Abdel-Aliem wrote:

> ID          Title               Cattegory
> 1            Matrix           Sci-Fi
> 2            Spartacus     History
> 3            Alexander     History
> 4            whatever       Horror
> 
> i want to list the categories only like this
> 
> Sci-Fi - History - Horror

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to