From ef2cb60f09aa4acfd93e4d28a1b4802dfcd2c35d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 9 Apr 2025 11:37:51 +0200 Subject: [PATCH] Beispiele --- test.php/datenbank.php | 23 +++++++++++++++++ test.php/index.php | 58 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 test.php/datenbank.php create mode 100644 test.php/index.php diff --git a/test.php/datenbank.php b/test.php/datenbank.php new file mode 100644 index 0000000..06ba613 --- /dev/null +++ b/test.php/datenbank.php @@ -0,0 +1,23 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $conn->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); + + $conn->beginTransaction(); + $sql = "SET NAMES 'utf8';"; + $conn->query($sql); + + $sql = "SELECT Wert1, Wert2, Wert3 FROM SpecialTable WHERE ID = 12;"; + $stmt = $conn->query($sql); + while($row = $stmt->fetch()) + { + echo "

".$row["Wert2"]."

"; + } + + $sql = "SELECT Wert1 FROM Datas WHERE Name LIKE '%$searchstring%';" + +?> \ No newline at end of file diff --git a/test.php/index.php b/test.php/index.php new file mode 100644 index 0000000..4a542e7 --- /dev/null +++ b/test.php/index.php @@ -0,0 +1,58 @@ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +"; + print_r($values); + echo "

"; + + + + $arr = [12,12,12,[12,12,12],12, "Hallo!", 22.5]; + + $arr[2] = "Halsdfsfsflo"; + $arr = 24; + + $arr = array(12 => "Hallo", 17 => "Hey", "Hoh" => "Hi"); + + $arr["aaa"] = 123; //"aaa" => 123 + + echo $arr["Hoh"]; //-> Hi + + //Ausgabe + print_r($arr); + + //Ausgabe in einer Foreach-Schleife: + foreach($arr as $element ) + echo "

".$element."

"; + + + +?> \ No newline at end of file