diff --git a/suchergebnisse.php b/suchergebnisse.php new file mode 100644 index 0000000..fb5beac --- /dev/null +++ b/suchergebnisse.php @@ -0,0 +1,281 @@ + + + + + + + + + + Candle Bibliothek | Suchergebnisse + + + + + + + + +
+

Suchergebnisse

+
+ $startYear"; + } + // Nur Endjahr + else if (!$startYear && $endYear) { + $yearQuery = "WHERE b.Erscheinungsjahr < $endYear"; + } + // Start- und Endjahr + else if ($startYear && $endYear) { + $yearQuery = "WHERE b.Erscheinungsjahr + BETWEEN $startYear AND $endYear"; + } + + $language = $_GET['language']; + if ($language == 'Alle Sprachen') { + $language = '%%'; + } + + $available = isset($_GET['status']); + if ($available) { + $available = 'Verfügbar'; + } + else { + $available = '%%'; + } + + // SQL-Befehl zusammenstellen + $sql = "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: ', 'Test!')) + 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 + $yearQuery + GROUP BY b.BuchID + HAVING $dropdown1 LIKE '%$search1%' + $andOr1 $dropdown2 LIKE '%$search2%' + $andOr2 $dropdown3 LIKE '%$search3%' + AND Sprache LIKE '$language' + AND Verfügbarkeit LIKE '$available';"; + } + else { + // Form wurde nicht erkannt + } + + $servername = "localhost"; + $username = "web_b-3"; + $password = "een7Ao6s"; + $dbname = "bibliothek_candle"; + + $connection = + mysqli_connect($servername, $username, $password, $dbname); + + if (!$connection) { + die("Verbindung fehlgeschlagen: " . mysqli_connect_error()); + } + + $result = mysqli_query($connection, $sql); + $counter = 0; + 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']; + + if ($counter != 0) { + echo "
"; + } + // TODO: OnClick auslagern. + echo "
+
+ Kein Bild vorhanden +
+
+

$bookTitle

+
+

Verfasser: $bookAuthor

+

+ Erscheinungsjahr: $bookPublishingYear

+

+ Verlag: $bookPublisher

+

+ Kategorie: $bookCategory

+
+
+

+ $bookAvailability

+ + +
+
+
+
+
+
"; + $counter++; + } + } else { + echo "Keine Ergebnisse."; + } + + if (!$result) { + die("Ungültige SQL-Abfrage: " . mysqli_connect_error()); + } + + mysqli_close($connection); + + ?> +
+
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/suchergebnisse_erweiterte_suche.php b/suchergebnisse_erweiterte_suche.php deleted file mode 100644 index a13e9ac..0000000 --- a/suchergebnisse_erweiterte_suche.php +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - Candle Bibliothek | Suchergebnisse - - - -
-

-

- Bibliothek Bild von einer Kerze -

Candle -

-
- Über Uns - Bücher - Meine Bücher - Abmelden -
- - -
- Erweiterte Suche - Bild von einem Wagen -
-
- - - -
-

Suchergebnisse

-
- $startYear"; - } - /* Nur Endjahr */ - else if (!$startYear && $endYear) { - $yearQuery = "WHERE b.Erscheinungsjahr < $endYear"; - } - /* Start- und Endjahr */ - else if ($startYear && $endYear) { - $yearQuery = - "WHERE b.Erscheinungsjahr BETWEEN $startYear AND $endYear"; - } - - $language = $_GET['language']; - if ($language == 'Alle Sprachen') { - $language = '%%'; - } - - $available = isset($_GET['status']); - if ($available) { - $available = 'Verfügbar'; - } - else { - $available = '%%'; - } - - /* SQL-Befehl zusammenstellen */ - $sql = "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: ', 'Test!')) - 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 - $yearQuery - GROUP BY b.BuchID - HAVING $dropdown1 LIKE '%$search1%' - $andOr1 $dropdown2 LIKE '%$search2%' - $andOr2 $dropdown3 LIKE '%$search3%' - AND Sprache LIKE '$language' - AND Verfügbarkeit LIKE '$available';"; - - $servername = "localhost"; - $username = "web_b-3"; - $password = "een7Ao6s"; - $dbname = "bibliothek_candle"; - - $connection = - mysqli_connect($servername, $username, $password, $dbname); - - if (!$connection) { - die("Verbindung fehlgeschlagen: " . mysqli_connect_error()); - } - - $result = mysqli_query($connection, $sql); - $counter = 0; - 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']; - - if ($counter != 0) { - echo "
"; - } - /* TODO: OnClick auslagern. */ - echo "
-
- Kein Bild vorhanden -
-
-

$bookTitle

-
-

Verfasser: $bookAuthor

-

- Erscheinungsjahr: $bookPublishingYear

-

- Verlag: $bookPublisher

-

- Kategorie: $bookCategory

-
-
-

- $bookAvailability

- - -
-
-
-
-
-
"; - $counter++; - } - } else { - echo "Keine Ergebnisse."; - } - - if (!$result) { - die("Ungültige SQL-Abfrage: " . mysqli_connect_error()); - } - - mysqli_close($connection); - - ?> -
-
- - - - - - - - - - - - - - - - - - \ No newline at end of file