From c701d808e5325147eb0b5788bcbaa2a3cf80aedc Mon Sep 17 00:00:00 2001 From: Grisu Date: Wed, 8 Jun 2022 12:05:55 +0200 Subject: [PATCH] shows table of avaiable Stations --- app/public/stationen.php | 19 +++++++++++++++++++ app/scripts/database_queries.php | 11 +++++++++++ app/scripts/functions.php | 10 ++++++++++ 3 files changed, 40 insertions(+) diff --git a/app/public/stationen.php b/app/public/stationen.php index 8590566..49d55fa 100644 --- a/app/public/stationen.php +++ b/app/public/stationen.php @@ -7,4 +7,23 @@ echo file_get_contents("html/header.html"); ?> + + +
+ + + + + + + + + + +
NameStandort
+
+ + \ No newline at end of file diff --git a/app/scripts/database_queries.php b/app/scripts/database_queries.php index 158e19a..e48ce15 100644 --- a/app/scripts/database_queries.php +++ b/app/scripts/database_queries.php @@ -62,4 +62,15 @@ function add_user($con, $username, $user_id, $user_group, $password, $salt) { } catch(PDOExeption $e) { handle_pdo_exception($e); } +} + +function get_stations($con) { + try { + $stmt = $con->prepare("SELECT name, standort FROM Station"); + $stmt->execute(); + $stmt->setFetchMode(PDO::FETCH_ASSOC); + return $stmt; + } catch(PDOException $e) { + handle_pdo_exceptio($e); + } } \ No newline at end of file diff --git a/app/scripts/functions.php b/app/scripts/functions.php index 88ec2da..58168d9 100644 --- a/app/scripts/functions.php +++ b/app/scripts/functions.php @@ -32,4 +32,14 @@ function generate_user_id($username, $salt) { function generate_password_hash($password, $salt) { $pword = $password . $salt; return hash('sha3-512', $pword); +} + +function load_stations_table($con) { + $stmt = get_stations($con); + foreach($stmt->fetchAll() as $row) { + echo ""; + echo "" . $row['name'] . ""; + echo "" . $row['standort'] . ""; + echo ""; + } } \ No newline at end of file