diff --git a/ci/application/controllers/Artistes.php b/ci/application/controllers/Artistes.php new file mode 100644 index 0000000..df69139 --- /dev/null +++ b/ci/application/controllers/Artistes.php @@ -0,0 +1,17 @@ +load->model('model_music'); + } + public function index(){ + $artistes = $this->model_music->getArtists(); + $this->load->view('layout/header'); + $this->load->view('artistes_list',['artistes'=>$artistes]); + $this->load->view('layout/footer'); + } + +} \ No newline at end of file diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php index ddcbb79..bd9f9ec 100644 --- a/ci/application/models/Model_music.php +++ b/ci/application/models/Model_music.php @@ -17,4 +17,14 @@ class Model_music extends CI_Model { ); return $query->result(); } + + public function getArtists(){ + $query = $this->db->query( + "SELECT artist.id, artist.name + FROM artist + Group by artist.id + " + ); + return $query->result(); + } } diff --git a/ci/application/views/artistes_list.php b/ci/application/views/artistes_list.php new file mode 100644 index 0000000..b193ed5 --- /dev/null +++ b/ci/application/views/artistes_list.php @@ -0,0 +1,14 @@ +
Artists list
+
+
"; + //echo "
"; + echo anchor("artistes/view/{$artistes->id}","{$artistes->name}"); + echo "
"; + echo "
"; + //echo " + //
"; +} +?> +