more fixes

This commit is contained in:
Samuel Wolff 2023-12-18 08:19:27 +01:00
parent c598e48006
commit 621e25ee86
3 changed files with 50 additions and 49 deletions

View File

@ -1,10 +1,10 @@
<?php <?php
//Programmiert von: Max Heer, Getestet von: //Programmiert von: Max Heer, Getestet von:
namespace kindergartenverwaltung\Controller; namespace ppb\Controller;
use kindergartenverwaltung\Libary\Msg; use ppb\Libary\Msg;
use kindergartenverwaltung\Model\EnthaeltModel; use ppb\Model\EnthaeltModel;
class EnthaeltController class EnthaeltController
{ {

View File

@ -3,7 +3,7 @@
// Programmiert durch Samuel Wolff // Programmiert durch Samuel Wolff
// Getestet durch: Nicht getestet // Getestet durch: Nicht getestet
namespace ppb\Controller; namespace ppb\Model;
use ppb\Library\Msg; use ppb\Library\Msg;
@ -38,7 +38,7 @@ class BenutzerModel extends Database
try { try {
$stmt = $pdo->prepare($sql); $stmt = $pdo->prepare($sql);
$stmt->excute($params); $stmt->execute($params);
} catch (\PDOException $e) { } catch (\PDOException $e) {
return false; return false;
} }
@ -80,7 +80,7 @@ class BenutzerModel extends Database
try { try {
$stmt = $pdo->prepare($sql); $stmt = $pdo->prepare($sql);
$stmt->excute($params); $stmt->execute($params);
} catch (\PDOException $e) { } catch (\PDOException $e) {
return false; return false;
} }

View File

@ -1,20 +1,21 @@
<?php <?php
namespace kindergartenverwaltung\EnthaeltModel; namespace ppb\EnthaeltModel;
use kindergartenverwaltung\Library\Msg; use ppb\Library\Msg;
class EnthaeltModel extends Database{ class EnthaeltModel extends Database
{
public function getEnthaelt($gerichtId){ public function getEnthaelt($gerichtId)
$pdo=$this->linkDB(); {
$pdo = $this->linkDB();
$params = array(); $params = array();
$sql = "SELECT * FROM Enthaelt WHERE gid = :gerichtId;"; $sql = "SELECT * FROM Enthaelt WHERE gid = :gerichtId;";
$params[":gerichtId"] = gerichtId; $params[":gerichtId"] = $gerichtId;
try{ try {
$stmt = $pdo->prepare($sql); $stmt = $pdo->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
} } catch (\PDOException $e) {
catch(\PDOExeption $e){
return false; return false;
} }
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC); $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
@ -22,31 +23,31 @@
return $result; return $result;
} }
public function insertEnthaelt($data){ public function insertEnthaelt($data)
$pdo=$this->linkDB(); {
$pdo = $this->linkDB();
$params = array(); $params = array();
$sql = "INSERT INTO Enthaelt ("; $sql = "INSERT INTO Enthaelt (";
foreach($data as $index=>$value){ foreach ($data as $index => $value) {
$sql .= "".$index.","; $sql .= "" . $index . ",";
} }
$sql = substr($sql,0,strlen($sql)-1).") VALUES ("; $sql = substr($sql, 0, strlen($sql) - 1) . ") VALUES (";
foreach($data as $index=>$value){ foreach ($data as $index => $value) {
$sql .= "':".$index."',"; $sql .= "':" . $index . "',";
$params[":".$index] = $value; $params[":" . $index] = $value;
} }
$sql = substr($sql,0,strlen($sql)-1).");"; $sql = substr($sql, 0, strlen($sql) - 1) . ");";
try{ try {
$stmt = $pdo->prepare($sql); $stmt = $pdo->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
return true; return true;
} } catch (\PDOException $e) {
catch(\PDOExeption $e){
return false; return false;
} }
} }
} }
?> ?>