Ejemplo n.º 1
0
function listSongs()
{
    $array_songs = getAllSongs();
    foreach ($array_songs as $song) {
        $id = $song["id"];
        $songName = $song["artist"] . ' - ' . $song["title"];
        $likes = $song["likes"];
        echo "<tr><td>{$id}</td><td>{$songName}</td><td>{$likes}</td><td><a href='App_Code/cmsView.php?type=song&delete={$id}'>DELETE</a></td></tr>";
    }
}
Ejemplo n.º 2
0
function getSongs()
{
    $songs = getAllSongs();
    foreach ($songs as $song) {
        $songID = $song["id"];
        $songName = $song["artist"] . ' - ' . $song["title"];
        $songCover = $song["cover_link"];
        echo "<a href='info.php?song={$songID}'><div class='album'>" . "<img src='{$songCover}' alt='Song Cover'/>" . "<p>{$songName}</p>" . "</div></a>";
    }
}
Ejemplo n.º 3
0
<?php

function getAllSongs($userID)
{
    $db_connection = new mysqli('stardock.cs.virginia.edu', 'cs4750ams5daa', 'music', 'cs4750ams5da');
    if (mysqli_connect_errno()) {
        echo "Connection Error!";
        return;
    }
    //original query "select s_id, Title, a_name FROM `Songs` natural join `Performed_by` where Songs.s_id = Performed_by.s_id"
    $stmt = $db_connection->stmt_init();
    if ($stmt->prepare("select s_id, Title, a_name FROM song_artist_album ORDER BY `song_artist_album`.`Title` ASC")) {
        $stmt->execute();
        $stmt->bind_result($s_id, $title, $name);
        while ($stmt->fetch()) {
            echo "<li id=" . $s_id . " onclick=\"play(this.id)\"><a href=\"javascript:;\">" . $title . " - " . $name . "</a></li>";
        }
    }
}
getAllSongs();