From 1747746007711ff07fdd55371e28020ebce431bf Mon Sep 17 00:00:00 2001 From: Luka Hietala Date: Thu, 30 Oct 2025 13:26:00 +0200 Subject: [PATCH] =?UTF-8?q?refaktori=20lis=C3=A4=C3=A4=20harjoittelupaikka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/uusharjoittelupaikka.php | 27 ++++++++++++++++++++++++++- src/lisaa_harjoittelupaikka.php | 18 ------------------ 2 files changed, 26 insertions(+), 19 deletions(-) delete mode 100644 src/lisaa_harjoittelupaikka.php diff --git a/public/uusharjoittelupaikka.php b/public/uusharjoittelupaikka.php index 6ee9830..e65d7ab 100644 --- a/public/uusharjoittelupaikka.php +++ b/public/uusharjoittelupaikka.php @@ -1,3 +1,28 @@ +prepare("INSERT INTO harjoittelupaikat (id, nimi, ohjaaja, yhteystiedot) VALUES (NULL, (?), (?), (?))"); + $stmt->bind_param("sss", $nimi, $ohjaaja, $yhteystiedot); + + if ($stmt->execute()) { + header("Location: " . "../public/harjoittelupaikat.php"); + exit(); + } else { + echo "Virhe: " . $stmt->error; + } + + $stmt->close(); + } + +?> + @@ -13,7 +38,7 @@

Lisää harjoittelupaikka

-
+
Harjoittelupaikan tiedot diff --git a/src/lisaa_harjoittelupaikka.php b/src/lisaa_harjoittelupaikka.php deleted file mode 100644 index 5fef5d3..0000000 --- a/src/lisaa_harjoittelupaikka.php +++ /dev/null @@ -1,18 +0,0 @@ -query($sql) === TRUE) { - echo "New record created successfully"; - } else { - echo "Error: " . $sql . "
" . $conn->error; - } - $conn->close(); -} -// Redirect -$newURL = "../public/harjoittelupaikat.php"; -header('Location: '.$newURL); -die(); -?> -- 2.47.3