, , :
Smokey Robinson and Miracles (2) | Sonic Youth (2) | Spoon (3) | Steely Dan (1) | Stevie Wonder (2) | Sufyan Stevens (1) |
Note that I used SELECT DISTINCT when I pulled “records” from the table. Here are the relevant code snippets:
$arttool = mysql_query("SELECT DISTINCT * FROM records GROUP BY artist ORDER BY artist ASC");
while($row = mysql_fetch_array($arttool)){
$current=$row['Artist'];
$artcount = mysql_num_rows(mysql_query("SELECT * FROM records WHERE artist = '$current'"));
echo $current . "($artcount)";
The actual code on my site is more complex, but it's its bones. Hope this helps ...
source
share