");
echo("Artists that perform this song:");
echo("");
$foundartist = 0;
$artistresult = mysql_query("SELECT so.ID as soID, ar.numsongs as numsongs, ar.artistname as artistname, ar.nameslug as nameslug FROM aasongsartists so, aaartists ar WHERE so.songid = '$thissongid' AND so.artistid = ar.ID ORDER BY ar.artistname");
while ($artistrow = mysql_fetch_array($artistresult)) {
echo("- " . htmlentities($artistrow["artistname"]) . " (" . $artistrow["numsongs"] . ")
");
$foundartist = 1;
}
echo(" ");
if ($foundartist == 0) {
echo("We currently have no artists in our database that have performed this song. ");
}
echo(" | ");
echo("Albums featuring this song");
echo("");
$foundalbum = 0;
$result = mysql_query("SELECT so.ID as arID, al.year as year, al.albumname as albumname, al.albumslug as albumslug FROM aasongsalbums so, aaalbums al WHERE so.songid = '$thissongid' AND so.albumid = al.ID ORDER BY al.year, al.albumname");
while ($row = mysql_fetch_array($result)) {
$thisalbumslug = $row["albumslug"];
if ($thisalbumslug == $previousalbumslug) {
// they're on this album more than once, so don't list it again
} else {
echo("- " . htmlentities($row["albumname"]) . "");
if ($row["year"] > 0) {
echo(" (" . $row["year"] . ")");
}
echo("
");
}
$previousalbumslug = $thisalbumslug;
$foundalbum = 1;
}
echo(" ");
if ($foundalbum == 0) {
echo("This song is not currently featured on any albums in our database. ");
}
echo(" |