/** * Gets song matches by querying the Grooveshark API for matches. * * @param search The phrase that is being searched for. Typically contains * the song, artist, and/or album. * * @return An array containing all of the song objects that matched the search * phrase. */ function getGroovesharkResults($search) { $songs = findSongs($search); foreach ($songs as $song) { if (!songIsInDb($song->id)) { if (!albumIsInDb($song->albumId)) { if (!artistIsInDb($song->artistId)) { addArtist($song->artistId, $song->artist); } $location = $song->arturl; addAlbum($song->albumId, $song->album, $song->artistId, $location, $song->arturl); } addSong($song->id, $song->title, $song->albumId, $song->track, $song->popularity, $song->duration); } } return $songs; }
} $query = "SELECT products.product_id, products.name, products.price, artists.artist_name, genres.genre_name , labels.label_name\n FROM products \n JOIN artists ON products.artist_id = artists.artist_id\n JOIN genres ON products.genre_id = genres.genre_id\n JOIN labels ON products.label_id = labels.label_id"; $result = mysqli_query($db, $query); if (!$result) { die('Invalid query: ' . mysqli_error($db)); } if (isset($_POST['add-product-button'])) { addProduct($db); header("Refresh:0"); } if (isset($_POST['delete-product-button'])) { deleteProduct($db); header("Refresh:0"); } if (isset($_POST['add-artist-button'])) { addArtist($db); header("Refresh:0"); } if (isset($_POST['add-label-button'])) { addLabel($db); header("Refresh:0"); } if (isset($_POST['add-genre-button'])) { addGenre($db); header("Refresh:0"); } ?> <!DOCTYPE html> <html lang="en">