52 lines
1016 B
PHP
52 lines
1016 B
PHP
|
<?php
|
||
|
|
||
|
namespace ppb\Model;
|
||
|
|
||
|
use ppb\Model\Database;
|
||
|
|
||
|
//Erstellt durch Stefan Groß - Samuel Wolff
|
||
|
|
||
|
class FilterModel extends Database
|
||
|
{
|
||
|
|
||
|
public function insertFilter($data)
|
||
|
{
|
||
|
$pdo = $this->linkDB();
|
||
|
|
||
|
$params = array();
|
||
|
|
||
|
$sql = "INSERT INTO Filter (kid, iid) VALUES (:kid, :iid)";
|
||
|
|
||
|
$params[":kid"] = $data["kid"];
|
||
|
$params[":iid"] = $data["iid"];
|
||
|
|
||
|
try {
|
||
|
$stmt = $pdo->prepare($sql);
|
||
|
$stmt->execute($params);
|
||
|
} catch (\PDOException $e) {
|
||
|
echo $sql;
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function deleteFilter($id)
|
||
|
{
|
||
|
$pdo = $this->linkDB();
|
||
|
|
||
|
$params = array();
|
||
|
|
||
|
$sql = "DELETE FROM Filter WHERE id = :id";
|
||
|
|
||
|
$params[":id"] = $id;
|
||
|
|
||
|
try {
|
||
|
$stmt = $pdo->prepare($sql);
|
||
|
$stmt->execute($params);
|
||
|
} catch (\PDOException $e) {
|
||
|
echo $sql;
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
}
|