Views music

This commit is contained in:
2024-06-05 08:08:12 +02:00
parent db5398a1d9
commit b2a2c3ce4a
4 changed files with 30 additions and 54 deletions

View File

@@ -153,36 +153,17 @@ class Model_music extends CI_Model {
public function getSongDetails($songId) {
// Get song details
$this->db->select('song.name as songName, song.id');
$this->db->from('song');
$this->db->where('song.id', $songId);
$songQuery = $this->db->get();
$songDetails = $songQuery->row();
// Get album details for the song
$this->db->select('album.id as albumId, album.name as albumName, album.year');
$this->db->from('album');
$this->db->join('track', 'track.albumId = album.id');
$this->db->where('track.songId', $songId);
$albumQuery = $this->db->get();
$albumDetails = $albumQuery->row();
// Get artist details for the album
$this->db->select('artist.id as artistId, artist.name as artistName');
$this->db->from('artist');
$this->db->join('album', 'album.artistId = artist.id');
$this->db->where('album.id', $albumDetails->albumId);
$artistQuery = $this->db->get();
$artistDetails = $artistQuery->row();
return array('song' => $songDetails, 'album' => $albumDetails, 'artist' => $artistDetails);
$this->db->select('song.name as songName, song.id as songId, album.name as albumName, album.id as albumId, album.year, artist.name as artistName, artist.id as artistId, cover.jpeg');
$this->db->from('track');
$this->db->join('album', 'track.albumId = album.id');
$this->db->join('song', 'song.id = track.songId');
$this->db->join('artist', 'album.artistid = artist.id');
$this->db->join('cover', 'cover.id = album.coverid');
$this->db->where('track.id', $songId);
$result = $this->db->get();
return $result->row_array();
}
// Suppression de la deuxième méthode researchtype