Form util classes + write Kurs Methode
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user