prepare("SELECT b.BuchID, b.Titel, b.Erscheinungsjahr, b.Bild, b.Verlag, GROUP_CONCAT(DISTINCT CONCAT(a.VorName, ' ', a.NachName) SEPARATOR ', ') AS 'Autor', GROUP_CONCAT(DISTINCT k.Name SEPARATOR ', ') AS 'Kategorie', b.ISBN, b.Klappentext AS 'Inhalt', sp.Bezeichnung AS 'Sprache', GROUP_CONCAT(DISTINCT st.Text SEPARATOR ', ') AS 'Stichwort', IF(b.Anzahl!=0, 'Verfügbar', CONCAT('Verfügbar ab: ', (SELECT DATE_FORMAT(DATE_ADD(ab.Enddatum, INTERVAL 1 DAY) ,'%d.%m.%Y') FROM `ausgeliehenes_buch` AS ab WHERE ab.BuchID = b.BuchID ORDER BY ab.Reserviert ASC, ab.Enddatum ASC LIMIT 1))) AS 'Verfügbarkeit' FROM `buch` AS b INNER JOIN `buch_verfasst_von_autor` AS bvva ON b.BuchID = bvva.BuchID INNER JOIN `autor` AS a ON bvva.AutorNr = a.AutorNr INNER JOIN `buch_hat_kategorie` AS bhk ON bhk.BuchID = b.BuchID INNER JOIN `kategorie` AS k ON k.KategorieID = bhk.KategorieID INNER JOIN `sprache` AS sp ON sp.SprachenID = b.SprachenID INNER JOIN `buch_hat_stichwort` AS bhs ON bhs.BuchID = b.BuchID INNER JOIN `stichwort` AS st ON st.StichwortID = bhs.StichwortID WHERE b.BuchID = ? GROUP BY b.BuchID;"); // Parameter binden $sql->bind_param("i", $ID); // Übergebene ID des angeklickten Container speichern $containerID = $_GET['bookID']; // Buch ID abtrennen $ID = str_replace('book_container', '', $containerID); // SQL-Befehl ausführen $sql->execute(); // Ergebnis speichern $result = $sql->get_result(); if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $bookID = $row['BuchID']; $bookCover = $row['Bild']; $bookTitle = $row['Titel']; $bookPublishingYear = $row['Erscheinungsjahr']; $bookPublisher = $row['Verlag']; $bookAuthor = $row['Autor']; $bookCategory = $row['Kategorie']; $bookAvailability = $row['Verfügbarkeit']; $bookContent = $row['Inhalt']; $bookISBN = $row['ISBN']; $bookLanguage = $row['Sprache']; $bookKeywords = $row['Stichwort']; /* TODO: OnClick auslagern. */ echo "
Kein Bild vorhanden

$bookTitle

Verfasser: $bookAuthor

Erscheinungsjahr: $bookPublishingYear

Verlag: $bookPublisher

Kategorie: $bookCategory

$bookAvailability

Inhalt

$bookContent

Details

ISBN: $bookISBN

Sprache: $bookLanguage

Stichwörter: $bookKeywords

"; } } else { echo "Keine Infos vorhanden."; } if (!$result) { die("Ungültige SQL-Abfrage: " . mysqli_connect_error()); } mysqli_close($connection); ?>