Form util classes + write Kurs Methode

This commit is contained in:
2025-06-23 12:18:22 +02:00
parent 8dd24a8c1e
commit c483058b1b
6 changed files with 38 additions and 12 deletions

View File

@@ -6,7 +6,30 @@ use PDOException;
class AdminModel extends Database
{
public function writeContactData($values)
public function writeNewCourse($values)
{
$guid = $this->createUUID();
$sql = "INSERT INTO kurs (`id`, `name`, `preis`, `dauer`, `rabatt`, `kategorie`, `beschreibung`) VALUES (
:guid, :name, :preis, :dauer, :rabatt, :kategorie, :beschreibung);";
$pdo = $this->linkDB();
try {
$sth = $pdo->prepare($sql);
$sth->execute(array(":guid" => $guid,
":name" => $values["name"],
":preis" => $values["preis"],
":dauer" => $values["dauer"],
":rabatt" => $values["rabatt"],
":kategorie" => $values["kategorie"],
":beschreibung" => $values["beschreibung"],
));
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
die;
}
return true;
}
}