= CURDATE() ORDER BY wettkampfkalender.Datum ASC;", ); $message["wkData"] .= "
"; if (!empty($_POST)) { if ( empty($_POST["f"]["wkId"]) || empty($_POST["f"]["date"]) || empty($_POST["f"]["meldefrist"]) ) { $message["notice"] .= "Alle Felder ausfüllen und abschicken!
"; if ($wkId != "") { $query = "SELECT lfdeNr, Datum, Veranstaltung, Altersklassen, Ort, Ausschreibung, Routenplaner FROM wettkampfkalender WHERE lfdeNr = :wkId;"; $params = [ ":wkId" => [ "value" => $wkId, "data_type" => PDO::PARAM_INT, ], ]; $results = dbConnector::query($query, $params); if (!$results) { $message["error"] .= "Fehler bei Datenbankabfrage {$query}"; } else { $result = $results[0]; $message["notice"] .= ""; $date = $result["Datum"]; $deadline = date( "Y-m-d", strtotime( "last friday", strtotime("last week", strtotime($result["Datum"])), ), ); } } } else { $wkId = filterId($_POST["f"]["wkId"]); $date = $_POST["f"]["date"]; $deadline = $_POST["f"]["meldefrist"]; $query = "INSERT INTO wkParticipo_Events (wkId, date, meldefrist) SELECT * FROM (SELECT :wkId, :date, :deadline) as new_event WHERE NOT EXISTS (SELECT wkId FROM wkParticipo_Events WHERE wkId = :wkId) LIMIT 1;"; $params = [ ":wkId" => ["value" => $wkId, "data_type" => PDO::PARAM_INT], ":date" => ["value" => $date, "data_type" => PDO::PARAM_STR], ":deadline" => [ "value" => $deadline, "data_type" => PDO::PARAM_STR, ], ]; $result = dbConnector::query($query, $params); $message["success"] .= "Neues Event zu wkId = " . htmlspecialchars($_POST["f"]["wkId"]) . " angelegt!" . ""; } } else { $message["notice"] .= "Übermitteln Sie das ausgefüllte Formular um ein neues Event zu erstellen."; } ?> wkParticipo - addEvent.php
Fehler
Erfolg
Hinweis
Eventdaten
/>
/>
/>
wkData