Gestion playlist et css
This commit is contained in:
@@ -38,31 +38,17 @@ class Model_music_artistes extends CI_Model {
|
||||
}
|
||||
|
||||
|
||||
public function searchArtistes($query){
|
||||
public function searchArtistes($query){
|
||||
// Requête SQL principale pour la recherche d'artistes par nom
|
||||
$sql = "SELECT artist.id AS artistId, artist.name AS artistName, album.name AS albumName, album.id AS albumId, album.year, cover.jpeg
|
||||
FROM album
|
||||
INNER JOIN artist ON album.artistId = artist.id
|
||||
JOIN cover ON cover.id = album.coverId
|
||||
GROUP BY artist.name, album.year";
|
||||
FROM album
|
||||
JOIN artist ON album.artistId = artist.id
|
||||
JOIN cover ON cover.id = album.coverId
|
||||
WHERE artist.name LIKE ?
|
||||
GROUP BY artist.name, album.year
|
||||
ORDER BY artist.name ASC";
|
||||
|
||||
$conditions = [];
|
||||
$params = [];
|
||||
|
||||
if (!empty($query)) {
|
||||
$conditions[] = "(album.name LIKE ? OR artist.name LIKE ?)";
|
||||
$params[] = "%{$query}%";
|
||||
$params[] = "%{$query}%";
|
||||
}
|
||||
|
||||
|
||||
if (count($conditions) > 0) {
|
||||
$sql .= " WHERE " . implode(' AND ', $conditions);
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY album.id ASC";
|
||||
|
||||
$query = $this->db->query($sql, $params);
|
||||
$query = $this->db->query($sql, ["%{$query}%"]);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user