Esempio n. 1
0
function delete_top11_song($id)
{
    $id = mysql_real_escape_string($id);
    $update = "UPDATE top11songs set deleted ='y' where id=" . $id;
    $result = mysql_query($update);
    if (!$result) {
        echo "'Error deleting the Top 11 song from the database: " . $update . "<br>";
    } else {
        $top11_song = get_top11_song($id);
        echo "<div class=\"center\"><h1>Success!</h1>" . "<h3>The Top 11 song <span class=\"success\">" . $top11_song['song'] . " by " . $top11_song['artist'] . "</span> has been deleted.</h3></div>";
    }
}
Esempio n. 2
0
        echo '<div class="top-spacer_20 center error">Error - missing ID value</div>';
    } elseif ($action == "update") {
        $top11_song = get_top11_song($id);
        echo "<form action=\"top11_song_update.php?id=" . $id . "\" method=\"post\" class=\"form-internal inline input-seperation\" id=\"admin\">";
        require "partials/_top11_song_form.php";
        echo "</form>";
    } else {
        $artist = $_POST['artist'];
        $song = $_POST['song'];
        if (!$artist || !$song) {
            echo '<div class="top-spacer_20 center error">Error - missing required value(s)</div>';
        } else {
            $result = update_top11_song($id, $artist, $song);
            if ($result) {
                echo '<div class="top-spacer_20 center"><h1>Update was successful!</h1>';
                display_top11_song(get_top11_song($id));
                echo "</div>";
            }
        }
    }
    ?>
    <div class="top-spacer_20">
      <a href="top11_song_view_all.php">View all Top 11 Songs</a>
      <p>
      <a href="cp.php">Control Panel</a>
    </div>
  </div>
</div> <!-- end of row div -->
<?php 
}
require "partials/_footer.php";