From 87b55086747446a7f02943fc5286e3628fc6bef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=A0krab=C3=A1nek?= Date: Thu, 12 Jan 2023 10:34:48 +0100 Subject: [PATCH] add up-del --- mysql-up-del/actions/delete.php | 18 +++++++++++ mysql-up-del/actions/index.php | 4 +++ mysql-up-del/actions/insert.php | 23 ++++++++++++++ mysql-up-del/actions/update.php | 40 ++++++++++++++++++++++++ mysql-up-del/index.php | 54 +++++++++++++++++++++++++++++++++ mysql-up-del/init.php | 9 ++++++ mysql-up-del/update.php | 43 ++++++++++++++++++++++++++ php-insert/index.php | 2 +- 8 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 mysql-up-del/actions/delete.php create mode 100644 mysql-up-del/actions/index.php create mode 100644 mysql-up-del/actions/insert.php create mode 100644 mysql-up-del/actions/update.php create mode 100644 mysql-up-del/index.php create mode 100644 mysql-up-del/init.php create mode 100644 mysql-up-del/update.php diff --git a/mysql-up-del/actions/delete.php b/mysql-up-del/actions/delete.php new file mode 100644 index 0000000..2775ff2 --- /dev/null +++ b/mysql-up-del/actions/delete.php @@ -0,0 +1,18 @@ + echo $sql . "
"; + +//vykonání příkazu a následný "report" +if (mysqli_query($conn,$sql)) { + echo "příkaz byl vykonán"; + header("Location: /?del=$id"); +} else { + echo "Error:" .$sql."
". mysqli_errno($conn); +} + + +?> \ No newline at end of file diff --git a/mysql-up-del/actions/index.php b/mysql-up-del/actions/index.php new file mode 100644 index 0000000..6c4301a --- /dev/null +++ b/mysql-up-del/actions/index.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/mysql-up-del/actions/insert.php b/mysql-up-del/actions/insert.php new file mode 100644 index 0000000..37a3686 --- /dev/null +++ b/mysql-up-del/actions/insert.php @@ -0,0 +1,23 @@ + echo $sql . "
"; +//vykonání příkazu a následný "report" +if (mysqli_query($conn,$sql)) { + $last_id = mysqli_insert_id($conn); + echo "příkaz byl vykonán - ID:" . $last_id; + header("Location: /?id=$last_id"); +} else { + echo "Error:" .$sql."
". mysqli_errno($conn); +} + + +?> \ No newline at end of file diff --git a/mysql-up-del/actions/update.php b/mysql-up-del/actions/update.php new file mode 100644 index 0000000..23d2233 --- /dev/null +++ b/mysql-up-del/actions/update.php @@ -0,0 +1,40 @@ +". mysqli_errno($conn); +} \ No newline at end of file diff --git a/mysql-up-del/index.php b/mysql-up-del/index.php new file mode 100644 index 0000000..6b8034f --- /dev/null +++ b/mysql-up-del/index.php @@ -0,0 +1,54 @@ + + + + + + + + KNIHOVNA + + +

Knihovna

+

UPDATE DATA

+ +
+
+
+
+ +
+ + Byla vytvořena kniha s ID:".$_GET["id"].""; + } + if (isset($_GET["del"])){ + echo "

Byla odstraněna kniha s ID:".$_GET["del"]."

"; + } + if (isset($_GET["up"])){ + echo "

Byla upravena kniha s ID:".$_GET["up"]."

"; + } + ?> + + + + + \ No newline at end of file diff --git a/mysql-up-del/init.php b/mysql-up-del/init.php new file mode 100644 index 0000000..a8a271e --- /dev/null +++ b/mysql-up-del/init.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/mysql-up-del/update.php b/mysql-up-del/update.php new file mode 100644 index 0000000..ccf3839 --- /dev/null +++ b/mysql-up-del/update.php @@ -0,0 +1,43 @@ + + + + + + + + UPDATE + + +

UPDATE DATA

+ +
+
+
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/php-insert/index.php b/php-insert/index.php index ddef3d8..5e1073c 100644 --- a/php-insert/index.php +++ b/php-insert/index.php @@ -3,7 +3,7 @@ require "init.php"; //příprava k zobrazení dat -$sql = "SELECT * FROM intro ORDER BY id DESC"; +$sql = "SELECT * FROM intro "; $result = mysqli_query($conn,$sql); ?>