Voll Upload SGD Fachinformatiker PHP

This commit is contained in:
2026-06-03 13:46:32 +00:00
parent 1256ec2190
commit 84a568d89c
265 changed files with 9961 additions and 2 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
//Variablen für Datenbankverbindung
include("list.php");
// Aufbau der Datenbankverbindung
try {
$pdo = new PDO("mysql:dbhost=$dbhost;dbname=$dbname;charset=utf8", $dbuser, $dbpw);
} catch (PDOException $e) {
die ($e->getMessage());
}
//Die SQL Anweisung wird in eine Variable gepackt
$sql = "SELECT * FROM teilnehmer LIMIT 5";
if($stmt = $pdo->query($sql)) {
echo "<h2>PDO::FETCH_ASSOC</h2>";
$a = $stmt->fetch(PDO::FETCH_ASSOC);
echo "<pre>", print_r($a) ,"</pre>";
echo "<h2>PDO::FETCH_NUM</h2>";
$a = $stmt->fetch(PDO::FETCH_NUM);
echo "<pre>", print_r($a) ,"</pre>";
echo "<h2>PDO::FETCH_BOTH</h2>";
$a = $stmt->fetch(PDO::FETCH_BOTH);
echo "<pre>", print_r($a) ,"</pre>";
echo "<h2>PDO::FETCH_OBJ</h2>";
$a = $stmt->fetch(PDO::FETCH_OBJ);
echo "<pre>", print_r($a) ,"</pre>";
echo "<h2>PDO::FETCH_LAZY</h2>";
$a = $stmt->fetch(PDO::FETCH_LAZY);
echo "<pre>", print_r($a) ,"</pre>";
}
?>