From 3d8b9928d6aa6a80eb43a6af4b5d739ecc9ec477 Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Fri, 31 May 2024 13:07:37 +0200 Subject: [PATCH] DB Test --- base/database.php | 2 +- tasks/dbTest/index.php | 58 ++++++++++++++++++++++++++++++++++++++++++ test/action.php | 35 ------------------------- test/index.css | 56 ---------------------------------------- test/index.php | 54 --------------------------------------- 5 files changed, 59 insertions(+), 146 deletions(-) create mode 100644 tasks/dbTest/index.php delete mode 100644 test/action.php delete mode 100644 test/index.css delete mode 100644 test/index.php diff --git a/base/database.php b/base/database.php index c2c3d02..7be8f7f 100644 --- a/base/database.php +++ b/base/database.php @@ -6,7 +6,7 @@ class DB extends PDO parent::__construct($dsn, $username, $password, $options); } - static function openConnection($config = "../configs/db.ini") + static function openConnection($config = "/home/k/khofmann/public_html/phpCourse/configs/db.ini") { $conn = null; try { diff --git a/tasks/dbTest/index.php b/tasks/dbTest/index.php new file mode 100644 index 0000000..a443dbd --- /dev/null +++ b/tasks/dbTest/index.php @@ -0,0 +1,58 @@ + + + + + + + Artikel + + + + prepare($query); + $stmt->execute(); + $result = $stmt->fetchAll(); + + DB::closeConnection($db); + ?> +
+ + + + + + + + + + + + + + + + +
#ArtikelnameLagerbestand
+
+ + + \ No newline at end of file diff --git a/test/action.php b/test/action.php deleted file mode 100644 index 84dd268..0000000 --- a/test/action.php +++ /dev/null @@ -1,35 +0,0 @@ -prepare($insert); - $stmt->bindParam(":NAME", $_POST["name"]); - $stmt->execute(); - - DB::closeConnection($db); - } - case "rem": { - $db = DB::openConnection(); - - $insert = "DELETE FROM users WHERE ID = :ID"; - - $stmt = $db->prepare($insert); - $stmt->bindParam(":ID", $_POST["ID"]); - $stmt->execute(); - - DB::closeConnection($db); - } - default: - break; -} - -Headers::redirect("."); diff --git a/test/index.css b/test/index.css deleted file mode 100644 index 4b26c5d..0000000 --- a/test/index.css +++ /dev/null @@ -1,56 +0,0 @@ -*, ::after, ::before { - box-sizing: border-box; -} - -body { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; - font-size: 1rem; - font-weight: 400; - line-height: 1.5; - color: #212529; - text-align: left; - background-color: #fff; -} - -.col { - display: flex; - flex-direction: column; - gap: 5px; - height: 100vh; -} - -.list { - margin: 10px; - overflow: scroll; - display: flex; - flex-direction: column; - gap: 5px; - flex-grow: 1; -} - -.list .item { - display: flex; - justify-content: space-between; - gap: 5px; -} - -.list .item .marker { - width: 40px; - text-align: end; -} - -.list .item .content { - width: 100%; - text-align: start; -} - -.add { - margin: 10px; - display: flex; - gap: 5px; -} - -.add input[name="name"] { - width: 100% -} \ No newline at end of file diff --git a/test/index.php b/test/index.php deleted file mode 100644 index 493d10a..0000000 --- a/test/index.php +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - Test - - - - prepare($query); - $stmt->execute(); - $result = $stmt->fetchAll(); - - DB::closeConnection($db); - ?> -
-
- -
- - -
- " /> - -
-
- -
-
- - - -
-
- - - \ No newline at end of file