74 lines
1.5 KiB
PHP
74 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace ppb\Model;
|
|
|
|
//Programmiert von Stefan Groß - Getestet von Samuel Wolff
|
|
|
|
class GibtsAmModel extends Database
|
|
{
|
|
|
|
public function selectGibtsAm()
|
|
{
|
|
$pdo = $this->linkDB();
|
|
|
|
$sql = "SELECT * FROM GibtsAm";
|
|
|
|
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]["id"] += 0;
|
|
$results[$key]["tid"] += 0;
|
|
$results[$key]["gid"] += 0;
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
public function insertGibtsAm($data)
|
|
{
|
|
$pdo = $this->linkDB();
|
|
|
|
$params = array();
|
|
|
|
$sql = "INSERT INTO GibtsAm (tid, gid) VALUES (:tid, :gid)";
|
|
$params[":tid"] = $data["tid"];
|
|
$params[":gid"] = $data["gid"];
|
|
|
|
try {
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt->execute($params);
|
|
} catch (\PDOException $e) {
|
|
echo $sql;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function deleteGibtsAm($id)
|
|
{
|
|
$pdo = $this->linkDB();
|
|
|
|
$params = array();
|
|
|
|
$sql = "DELETE FROM GibtsAm WHERE id = :id";
|
|
|
|
$params[":id"] = $id;
|
|
|
|
try {
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt->execute($params);
|
|
} catch (\PDOException $e) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
?>
|