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
//Programmiert von: Max Heer, Getestet von:
namespace kindergartenverwaltung\Controller;
namespace ppb\Controller;
use kindergartenverwaltung\Libary\Msg;
use kindergartenverwaltung\Model\EnthaeltModel;
use ppb\Libary\Msg;
use ppb\Model\EnthaeltModel;
class EnthaeltController
{

View File

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

View File

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