Re: Display only one filed of the repeated records

From: Date: Tue, 30 Nov 2004 11:59:25 +0000
Subject: Re: Display only one filed of the repeated records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203128@lists.php.net to get a copy of this message
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

« previous php.general (#203128) next »