tabelle ." ORDER BY name"; $this->baueDozentenTabelle($sql); } private function baueDozentenTabelle($sql) { require_once("db.inc.php"); if ($stmt = $pdo -> prepare($sql)) { $stmt -> execute(); echo "\n\t"; echo ""; echo "\n\t"; $count = 0; while ($z = $stmt -> fetch()) { $count += 1; $zebratyp = "ungerade"; echo "\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n"; } echo "\n
NummerNameVornamePlzOrtStraßeHaus-Nr.Telefon 1Telefon 2E-MailBearbeiten
" . htmlspecialchars($z['doznr']) ."" . htmlspecialchars($z['name']) ."" . htmlspecialchars($z['vname']) ."" . htmlspecialchars($z['plz']) ."" . htmlspecialchars($z['ort']) ."" . htmlspecialchars($z['strasse']) ."" . htmlspecialchars($z['hausnr']) ."" . htmlspecialchars($z['telefon1']) ."" . htmlspecialchars($z['telefon2']) ."" . htmlspecialchars($z['email']) ."" ."bearbeiten" ."
"; } } public function lesenDatensatz($id) { require("db.inc.php"); $sql = "SELECT name, vname, plz, ort, strasse, hausnr,telefon1, telefon2, email FROM " .$this->tabelle ." WHERE doznr=:doznr"; if($stmt = $pdo->prepare($sql)) { $stmt->bindParam(':doznr', $id); $stmt->execute(); return($stmt->fetch(PDO::FETCH_ASSOC)); } return(false); } public function bearbeiten(){ require("db.inc.php"); $doznr = $_GET['mode']; $name = $_GET['name']; $vname = $_GET['vname']; $plz = $_GET['plz']; $ort = $_GET['ort']; $strasse = $_GET['strasse']; $hausnr = $_GET['hausnr']; $telefon1 = $_GET['telefon1']; $telefon2 = $_GET['telefon2']; $email = $_GET['email']; $sql = "UPDATE ".$this->tabelle . "SET name = :name, vname = :vname, plz = :plz, ort = :ort, strasse = :strasse, hausnr = :hausnr, telefon1 = :telefon1, telefon2 = :telefon2 email = :email WHERE doznr = :doznr"; if($stmt = $pdo->prepare($sql)) { $param = array( ':doznr' => $doznr, ':name' => $name, ':vname' => $vname, ':plz' => $plz, ':ort' => $ort, ':strasse' => $strasse, ':hausnr' => $hausnr, ':telefon1' => $telefon1, ':telefon2' => $telefon2, ':email' => $email, ); if($stmt->execute($param)) { echo "

Datensatz erfolgreich gespeichert

"; } else { echo "

Fehler beim Speichern!

"; } } } public function anlegen() { require("db.inc.php"); $doznr = $_GET['mode']; $name = $_GET['name']; $vname = $_GET['vname']; $plz = $_GET['plz']; $ort = $_GET['ort']; $strasse = $_GET['strasse']; $hausnr = $_GET['hausnr']; $telefon1 = $_GET['telefon1']; $telefon2 = $_GET['telefon2']; $email = $_GET['email']; $sql = "INSERT INTO " .$this->tabelle ." ( doznr, name, vname, plz, ort, strasse, hausnr, telefon1, telefon2, email) VALUES ( :doznr, :name, :vname, :plz, :ort, :strasse, :hausnr, :telefon1, :telefon2, :email)"; if($stmt = $pdo->prepare($sql)) { $param = array( ':doznr' => $doznr, ':name' => $name, ':vname' => $vname, ':plz' => $plz, ':ort' => $ort, ':strasse' => $strasse, ':hausnr' => $hausnr, ':telefon1' => $telefon1, ':telefon2' => $telefon2, ':email' => $email, ); if($stmt->execute($param)) { echo "

Datensatz erfolgreich gespeichert

"; } else { echo "

Fehler beim Speichern!

"; } } } public function loeschen($id){ require("db.inc.php"); $sql = "DELETE FROM " .$this->tabelle ." WHERE doznr = :doznr"; if($stmt = $pdo->prepare($sql)) { $stmt->bindParam(':doznr', $id); $stmt->execute(); } } } ?>