false, "match" => $match, "artistes" => array(), "downloads" => array(), "albums" => array() ); try { if($match) { $sql = "SELECT id, nom, style, image" ." FROM #--artistes" ." WHERE nom LIKE ".$this->eq("%".$match."%") ." OR style LIKE ".$this->eq("%".$match."%"); $rst = $this->sql->query($sql); while($v_rst = $this->sql->fetch_assoc($rst)) $results["artistes"][$v_rst["id"]] = $v_rst; $this->sql->free_result($rst); $sql = "SELECT #--downloads.*" .", #--downloads.id as id_download" .", #--downloads.nom as titre" .", #--downloads.date_creation as date_created" .", #--artistes.id as id_artiste" .", #--artistes.nom as auteur" .", #--licences.nom as licence" .", #--licences.lien as licence_url" ." FROM #--artistes" .", #--downloads" .", #--licences" ." WHERE #--downloads.id_artiste=#--artistes.id" ." AND #--downloads.id_licence=#--licences.id" ." AND actif=1" ." AND #--downloads.nom LIKE ".$this->eq("%".$match."%"); $rst = $this->sql->query($sql); while($v_rst = $this->sql->fetch_assoc($rst)) { $results["downloads"][$v_rst["id"]] = $v_rst; $results["downloads"][$v_rst["id"]]["urls"] = array(); $u_sql = "SELECT #--download_urls.*, #--formats.nom as format" ." FROM #--download_urls, #--formats" ." WHERE id_download=".$v_rst["id"] ." AND #--download_urls.id_format=#--formats.id"; $u_rst = $this->sql->query($u_sql); while($v_u_rst = $this->sql->fetch_assoc($u_rst)) { $results["downloads"][$v_rst["id"]]["urls"][$v_u_rst["id"]] = $v_u_rst; if($v_u_rst["format"] === "mp3") { $results["downloads"][$v_rst["id"]]["mp3_id_url"] = $v_u_rst["id"]; $results["downloads"][$v_rst["id"]]["mp3_url"] = $v_u_rst["url"]; } } $this->sql->free_result($u_rst); } $this->sql->free_result($rst); $results["has_results"] = $results["artistes"] || $results["downloads"] || $results["albums"]; } } catch(Exception $_e) { $results = false; } return $results; } } ?>