VPR_Schnittstelle/Model/istTeilModel.php
2024-01-14 17:51:11 +01:00

74 lines
1.5 KiB
PHP

<?php
namespace ppb\Model;
//Programmiert von Stefan Groß
//getestet von Samuel Wolff
class istTeilModel extends Database
{
public function selectIstTeil()
{
$pdo = $this->linkDB();
$sql = "SELECT * FROM istTeil";
try {
$stmt = $pdo->prepare($sql);
$stmt->execute();
} catch (\PDOException $e) {
return false;
}
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($results as $key => $value) {
$results[$key]["bid"] += 0;
$results[$key]["gid"] += 0;
$results[$key]["id"] += 0;
}
return $results;
}
public function insertIstTeil($data)
{
$pdo = $this->linkDB();
$params = array();
$sql = "INSERT INTO istTeil (bid, gid) VALUES (:bid, :gid)";
foreach ($data as $key => $value) {
$params[":" . $key] = $value;
}
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
return false;
}
return true;
}
public function deleteIstTeil($id)
{
$pdo = $this->linkDB();
$params = array();
$sql = "DELETE FROM istTeil WHERE id = :id";
$params[":id"] = $id;
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
return false;
}
return true;
}
}
?>