ajout liste des artistes

This commit is contained in:
Wilfried BRIGITTE 2024-05-23 11:41:06 +02:00
parent 8d97b8f5a1
commit 4f60ba344d
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class artistes extends CI_Controller {
public function __construct(){
parent::__construct();
$this->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');
}
}

View File

@ -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();
}
}

View File

@ -0,0 +1,14 @@
<h5>Artists list</h5>
<section class="list">
<?php
foreach($artistes as $artistes){
//echo "<div><article>";
//echo "<header class='short-text'>";
echo anchor("artistes/view/{$artistes->id}","{$artistes->name}");
echo "<br>";
echo "</header>";
//echo "<footer class='short-text'>{$artistes->year} - {$artistes->artistName}</footer>
//</article></div>";
}
?>
</section>