Kapitel 6 Lektion 7 gesplittet

This commit is contained in:
Jan Unger
2016-08-25 20:50:07 +02:00
parent 88cf71d772
commit a4afe1a11c
16 changed files with 843 additions and 45 deletions

View File

@@ -5,12 +5,8 @@ require __DIR__ . '/_application.php';
$db = holeDatenbankverbindung();
if (count($_POST) > 0) {
$insertStatement = $db->prepare("INSERT INTO lieder (cd_id, track, titel) VALUES (:cd_id, :track, :titel)");
$insertStatement->execute([
'cd_id' => $_GET['id'],
'track' => $_POST['track'],
'titel' => $_POST['titel']
]);
// TODO: Lied in die Datenbank speichern
header('Location: cd.php?id=' . htmlspecialchars($_GET['id']));
exit;
@@ -29,7 +25,7 @@ $cdStatement = $db->prepare("
$cdStatement->execute(['cd_id' => $_GET['id']]);
$cd = $cdStatement->fetch(PDO::FETCH_ASSOC);
$liederStatement = $db->prepare("SELECT * FROM lieder where cd_id = :cd_id ORDER BY track ASC");
$liederStatement = $db->prepare("SELECT * FROM lieder where cd_id = :cd_id");
$liederStatement->execute(['cd_id' => $_GET['id']]);
$lieder = $liederStatement->fetchAll(PDO::FETCH_ASSOC);