adding views songs
This commit is contained in:
		@@ -152,24 +152,36 @@ class Model_music extends CI_Model {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    public function getSongDetails($songId) {
 | 
			
		||||
        // Get song details
 | 
			
		||||
        $this->db->select('song.name as songName, track.id as trackId, album.name as albumName, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg');
 | 
			
		||||
        $this->db->from('track');
 | 
			
		||||
        $this->db->join('song', 'track.songId = song.id');
 | 
			
		||||
        $this->db->join('album', 'track.albumId = album.id');
 | 
			
		||||
        $this->db->join('artist', 'album.artistid = artist.id');
 | 
			
		||||
        $this->db->join('genre', 'album.genreid = genre.id');
 | 
			
		||||
        $this->db->join('cover', 'album.coverid = cover.id');
 | 
			
		||||
        $this->db->where('track.id', $songId);
 | 
			
		||||
        $this->db->select('song.name as songName, song.id');
 | 
			
		||||
        $this->db->from('song');
 | 
			
		||||
        $this->db->where('song.id', $songId);
 | 
			
		||||
        $songQuery = $this->db->get();
 | 
			
		||||
        return $songQuery->row();
 | 
			
		||||
        $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);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    // Suppression de la deuxième méthode researchtype
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user