Test details artiste 1/?

This commit is contained in:
Vincent
2024-06-04 22:55:02 +02:00
parent 9db959c8d1
commit a59966d698
3 changed files with 53 additions and 0 deletions

View File

@@ -123,6 +123,26 @@ class Model_music extends CI_Model {
return array('album' => $albumDetails, 'songs' => $songs);
}
public function getArtistDetails($artistId) {
// Get artist info
$this->db->select('artist.name as artistName, artist.id, genre.name as genreName, artist.jpeg');
$this->db->from('artist');
$this->db->join('album', 'album.artistid = artist.id');
$this->db->join('genre', 'genre.id = album.genreid');
$this->db->where('artist.id', $artistId);
$artistQuery = $this->db->get();
$artistDetails = $artistQuery->row();
// Get artist's albums
$this->db->select('album.name as albumName, album.id as albumId, album.year');
$this->db->from('album');
$this->db->where('album.artistid', $artistId);
$albumsQuery = $this->db->get();
$albums = $albumsQuery->result();
return array('artist' => $artistDetails, 'albums' => $albums);
}