diff --git a/CodeIgniter-3.1.13/application/controllers/Chansons.php b/CodeIgniter-3.1.13/application/controllers/Chansons.php new file mode 100644 index 0000000..0bdcf6f --- /dev/null +++ b/CodeIgniter-3.1.13/application/controllers/Chansons.php @@ -0,0 +1,19 @@ +load->model('model_music'); + $this->load->helper('html'); + $this->load->helper('url'); + } + public function index(){ + $chansons = $this->model_music->getChansons(); + $this->load->view('layout/header'); + $this->load->view('chansons_list',['chansons'=>$chansons]); + $this->load->view('layout/footer'); + } + +} diff --git a/CodeIgniter-3.1.13/application/models/Model_music.php b/CodeIgniter-3.1.13/application/models/Model_music.php index 46f1380..26a1035 100644 --- a/CodeIgniter-3.1.13/application/models/Model_music.php +++ b/CodeIgniter-3.1.13/application/models/Model_music.php @@ -27,4 +27,18 @@ class Model_music extends CI_Model { ); return $query->result(); } + + public function getChansons(){ + $query = $this->db->query( + "SELECT song.name,song.id,album.year,album.name as albumName, artist.name as artistName, genre.name as genreName + FROM song + JOIN track ON track.songId = song.id + JOIN album ON album.id = track.albumId + JOIN artist ON album.artistid = artist.id + JOIN genre ON genre.id = album.genreid + ORDER BY album.year + " + ); + return $query->result(); + } } diff --git a/CodeIgniter-3.1.13/application/views/chansons_list.php b/CodeIgniter-3.1.13/application/views/chansons_list.php new file mode 100644 index 0000000..a59ca32 --- /dev/null +++ b/CodeIgniter-3.1.13/application/views/chansons_list.php @@ -0,0 +1,15 @@ +