ajout tout les morceau d'un artiste
This commit is contained in:
@@ -107,4 +107,25 @@ class Model_music extends CI_Model {
|
||||
);
|
||||
}
|
||||
|
||||
public function addAllSongsOfArtistInPlaylist($artistId, $playlistId){
|
||||
// Récupérer toutes les chansons de l'artiste spécifié
|
||||
$query = $this->db->query(
|
||||
"SELECT song.name
|
||||
FROM song, track, album
|
||||
WHERE song.id = track.songId
|
||||
AND track.albumId = album.id
|
||||
AND album.artistId = ?",
|
||||
array($artistId)
|
||||
);
|
||||
|
||||
$songs = $query->result();
|
||||
|
||||
// Ajouter chaque chanson dans la playlist spécifiée
|
||||
foreach ($songs as $song) {
|
||||
$this->db->query(
|
||||
"INSERT INTO SongPlaylist (id, name) VALUES (?, ?)",
|
||||
array($playlistId, $song->name)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user