Fix query 2/?
This commit is contained in:
@@ -55,16 +55,20 @@ class Model_music extends CI_Model {
|
||||
|
||||
$this->db->distinct("artist.name");
|
||||
|
||||
if(!empty($genre)){
|
||||
if (!empty($genre)) {
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
|
||||
if($order == 'asc' || $order == 'desc'){
|
||||
$this->db->order_by('artist.name',$order );
|
||||
if ($order == 'asc' || $order == 'desc') {
|
||||
$this->db->order_by('artist.name', $order);
|
||||
}
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
if (!empty($query)) {
|
||||
$this->db->like('artist.name', $query);
|
||||
}
|
||||
|
||||
$result = $this->db->get();
|
||||
return $result->result();
|
||||
}
|
||||
|
||||
public function getMusics($genre = '', $order = '', $artist = '') {
|
||||
@@ -77,20 +81,24 @@ class Model_music extends CI_Model {
|
||||
$this->db->join('cover', 'cover.id = album.coverid');
|
||||
$this->db->limit(100);
|
||||
|
||||
if(!empty($genre)){
|
||||
if (!empty($genre)) {
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
|
||||
if(!empty($artist)){
|
||||
if (!empty($artist)) {
|
||||
$this->db->where('artist.name', $artist);
|
||||
}
|
||||
|
||||
if($order == 'asc' || $order == 'desc'){
|
||||
$this->db->order_by('song.name',$order );
|
||||
if ($order == 'asc' || $order == 'desc') {
|
||||
$this->db->order_by('song.name', $order);
|
||||
}
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
if (!empty($query)) {
|
||||
$this->db->like('song.name', $query);
|
||||
}
|
||||
|
||||
$result = $this->db->get();
|
||||
return $result->result();
|
||||
}
|
||||
|
||||
// Suppression de la deuxième méthode researchtype
|
||||
|
Reference in New Issue
Block a user