Fix query 4/?
This commit is contained in:
		@@ -46,32 +46,33 @@ class Model_music extends CI_Model {
 | 
			
		||||
        return $query->result();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getArtists($genre = '', $order = '') {
 | 
			
		||||
    public function getArtists($genre = '', $order = 'asc', $query = '') {
 | 
			
		||||
        $this->db->select('artist.name as artistName, artist.id as artistId');
 | 
			
		||||
        $this->db->from('artist');
 | 
			
		||||
        $this->db->join('album', 'album.artistid = artist.id');
 | 
			
		||||
        $this->db->join('genre', 'genre.id = album.genreid');
 | 
			
		||||
        $this->db->join('cover', 'cover.id = album.coverid');
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
        $this->db->distinct("artist.name");
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
        if (!empty($genre)) {
 | 
			
		||||
            $this->db->where('genre.name', $genre);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
        if ($order == 'asc' || $order == 'desc') {
 | 
			
		||||
            $this->db->order_by('artist.name', $order);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
        if (!empty($query)) {
 | 
			
		||||
            $this->db->like('artist.name', $query);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
        $result = $this->db->get();
 | 
			
		||||
        return $result->result();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public function getMusics($genre = '', $order = '', $artist = '') {
 | 
			
		||||
    public function getMusics($genre = '', $order = '', $artist = '', $query = '') {
 | 
			
		||||
        $this->db->select('album.name, album.id, year, artist.name as artistName, genre.name as genreName, jpeg, song.name as trackName, track.id as trackId');
 | 
			
		||||
        $this->db->from('track');
 | 
			
		||||
        $this->db->join('album', 'track.albumId = album.id');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user