Wait... you're running the same query twice? That doesn't seem very efficient... why not just do something like:
$sql = mysql_query("SELECT * FROM music WHERE userId = 'test'");
if(mysql_num_rows($sql) == 0)
echo " Blank \n";
else
while($r = mysql_fetch_array($sql)) {
$string = "";
if ($r['band']) $string .= "Band, ";
if ($r['barbershop']) $string .= "Barbershop, ";
if ($r['classical']) $string .= "Classical, ";
if ($r['country']) $string .= "Country, ";
if ($r['dance']) $string .= "Dance, ";
if ($r['electric']) $string .= "Electroinical, ";
if ($r['folk']) $string .= "Folk, ";
if ($r['jazz']) $string .= "Jazz, ";
if ($r['metal']) $string .= "Metal, ";
if ($r['opera']) $string .= "Opera/Musicals, ";
if ($r['orchestra']) $string .= "Orchestra, ";
if ($r['punk']) $string .= "Punk Rock, ";
if ($r['ragtime']) $string .= "Ragtime, ";
if ($r['rap']) $string .= "Rap/Hip Hop, ";
if ($r['reggae']) $string .= "Reggae/Ska, ";
if ($r['religious']) $string .= "Religious, ";
if ($r['rock_pop']) $string .= "Rock/Pop/Alternative, ";
if ($r['world']) $string .= "World, ";
if ($r['othr_music']) $string .= $r['othr_music_txt'];
$string = rtrim($string, ", ");
echo " $string \n";
}
EDIT: Oops, didn't read the code very well the first time through... :p