"; echo "
diff --git a/ci/application/controllers/Playlist.php b/ci/application/controllers/Playlist.php index 8625daa..6447a49 100644 --- a/ci/application/controllers/Playlist.php +++ b/ci/application/controllers/Playlist.php @@ -14,4 +14,18 @@ class Playlist extends CI_Controller { $this->load->view('playlist_list', ['playlists' => $playlists]); //$this->load->view('layout/footer_album'); } + + public function view(){ + $playlists = $this->model_music->deletePlaylist(); + //$this->load->view('layout/header_album'); + $this->load->view('playlist_list', ['playlists' => $playlists]); + //$this->load->view('layout/footer_album'); + } + + public function SongPLaylist($playlist_id){ + $songPlaylists = $this->model_music->getSongOfPlaylist($playlist_id); + //$this->load->view('layout/header_album'); + $this->load->view('song_playlist', ['songPlaylists' => $songPlaylists]); + //$this->load->view('layout/footer_album'); + } } \ No newline at end of file diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php index 3b070f8..8d22e5b 100644 --- a/ci/application/models/Model_music.php +++ b/ci/application/models/Model_music.php @@ -38,6 +38,27 @@ class Model_music extends CI_Model { return $query->result(); } + public function deletePlaylist(){ + $query = $this->db->query( + "SELECT playlist.id, playlist.name + FROM playlist + Group by playlist.id + " + ); + return $query->result(); + } + + public function getSongOfPlaylist($playlist_id){ + $query = $this->db->query( + "SELECT SongPlaylist.name + FROM SongPlaylist + WHERE $playlist_id = SongPlaylist.id; + + " + ); + return $query->result(); + } + public function getSongOfAlbum($album_id){ $query = $this->db->query( "SELECT song.id, song.name diff --git a/ci/application/views/playlist_list.php b/ci/application/views/playlist_list.php index 7493091..cfd1997 100644 --- a/ci/application/views/playlist_list.php +++ b/ci/application/views/playlist_list.php @@ -3,7 +3,14 @@ foreach($playlists as $playlist){ echo "