';
$artist_info .= '
Songs
';
// Loop door de resultaten van de query en voeg de nummers van de artiest toe aan de lijst
while($row = mysqli_fetch_assoc($result_artist_info)) {
$title = $row['title'];
$last_played = $row['date_played']; // Haal de laatst gespeelde datum op
$year_played = date('Y', strtotime($last_played)); // Haal het jaar op van de laatst gespeelde datum
$artist_info .= '
'.$title.' ('.$year_played.')
';
}
$artist_info .= '
';
// Voeg een sectie toe om de albums van de artiest weer te geven
$artist_info .= '';
$artist_info .= '
Albums
';
$sql_albums = "SELECT DISTINCT album, YEAR(date_played) AS year FROM songs WHERE artist = '$artist'";
$result_albums = mysqli_query($db_conx, $sql_albums);
if(mysqli_num_rows($result_albums) > 0) {
$artist_info .= '
';
while($row = mysqli_fetch_assoc($result_albums)) {
$album = $row['album'];
$year = $row['year'];
$artist_info .= '- '.$album.' ('.$year.')
';
}
$artist_info .= '
';
} else {
$artist_info .= '
No albums found for this artist.
';
}
$artist_info .= '
';
} else {
$artist_info = 'No information available for this artist';
}
} else {
$artist_info = 'No artist selected';
}
echo $artist_info;
?>