コード例 #1
0
ファイル: top11_fns.php プロジェクト: ynotradio/site
function add_top11_song($artist, $song)
{
    $artist = mysql_real_escape_string($artist);
    $song = mysql_real_escape_string($song);
    $insert = "INSERT INTO top11songs VALUES (id, '" . $artist . "', '" . $song . "', 0, 'n')";
    $result = mysql_query($insert);
    if (!$result) {
        echo $insert . "<br>";
        die('Error Inserting into Database.');
    }
    echo "<div class=\"center\"><h1>Success!</h1>" . "<h3>The new Top 11 song has been saved</h3>" . "<hr width=75%>";
    display_top11_song(get_top11_song(mysql_insert_id()));
    echo "</div>";
}
コード例 #2
0
ファイル: top11_song_update.php プロジェクト: ynotradio/site
        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";