test filtre 2/?

This commit is contained in:
2024-06-04 16:18:03 +02:00
parent ea2e857196
commit 4b5b72f2c0
3 changed files with 84 additions and 69 deletions

View File

@@ -5,32 +5,42 @@ class Model_music extends CI_Model {
$this->load->database();
}
public function getAlbums($genre = '', $order = '', $artist = '') {
$this->db->select('album.name, album.id, year, artist.name as artistName, genre.name as genreName, jpeg');
$this->db->from('album');
$this->db->join('artist', 'album.artistid = artist.id');
$this->db->join('genre', 'genre.id = album.genreid');
$this->db->join('cover', 'cover.id = album.coverid');
public function getAlbums($genre = '', $order = 'asc', $artist = '') {
$this->db->select('album.name, album.id, year, artist.name as artistName, genre.name as genreName, jpeg');
$this->db->from('album');
$this->db->join('artist', 'album.artistid = artist.id');
$this->db->join('genre', 'genre.id = album.genreid');
$this->db->join('cover', 'cover.id = album.coverid');
if(!empty($genre)){
$this->db->where('genre.name', $genre);
}
if(!empty($genre)){
$this->db->where('genre.name', $genre);
}
if(!empty($artist)){
$this->db->where('artist.name', $artist);
}
if(!empty($artist)){
$this->db->where('artist.name', $artist);
}
if($order == 'asc' || $order == 'desc'){
$this->db->order_by('album.name', $order);
}
$query = $this->db->get();
return $query->result();
}
if($order == 'asc' || $order == 'desc'){
$this->db->order_by('album.name',$order );
}
$query = $this->db->get();
return $query->result();
}
public function researchtype(){
$this->db->select('name');
$this->db->from('genre');
$query = $this->db->get();
return $query->result();
}
public function nameArtist(){
$this->db->select('name');
$this->db->from('artist');
$query = $this->db->get();
return $query->result();
}
public function getArtists($genre = '', $order = '') {