Commit e56049a6 authored by KYC's avatar KYC

kleine aanpassing

parent 930d8c12
......@@ -109,7 +109,15 @@ if (empty($_POST['getActivityID']) == FALSE) {
// Sql query to insert and check each variable with mysqli_real_escape_string()
$sql = sprintf("UPDATE Leefpatroon
SET ActivityID = '%s', StartTime = '%s', EndTime = '%s', Activity = '%s', Movement = '%s', Day = '%s', Comment = '%s', OuderID = '%s'
WHERE " . $activityID . " = ActivityID ", mysqli_real_escape_string($conn, $activityID), mysqli_real_escape_string($conn, $startTime), mysqli_real_escape_string($conn, $endTime), mysqli_real_escape_string($conn, $activity), mysqli_real_escape_string($conn, $movement), mysqli_real_escape_string($conn, $day), mysqli_real_escape_string($conn, $comment), mysqli_real_escape_string($conn, $OuderID));
WHERE " . $activityID . " = ActivityID ",
mysqli_real_escape_string($conn, $activityID),
mysqli_real_escape_string($conn, $startTime),
mysqli_real_escape_string($conn, $endTime),
mysqli_real_escape_string($conn, $activity),
mysqli_real_escape_string($conn, $movement),
mysqli_real_escape_string($conn, $day),
mysqli_real_escape_string($conn, $comment),
mysqli_real_escape_string($conn, $OuderID));
// run the query
if (!mysqli_query($conn, $sql)) {
......@@ -184,11 +192,11 @@ else {
$selectQuery = "SELECT StartTime, EndTime, Activity, Day FROM Leefpatroon WHERE OuderID = '$OuderID'";
$result = $conn->query($selectQuery);
while ($row = $result->fetch_assoc()) {
// if StartTime is the same as another activity's one on the same day, exit
// if StartTime is the same as another activity's one on the same day
if ($startTime == $row["StartTime"] && $day == $row["Day"]) {
$errors++;
echo '<p ' . $redTextError . '>Er is al een activiteit geregistreerd op dezelfde Begintijd voor (' . $row["Activity"] . ').</p>';
// if StartTime is during another activity on the same day, exit
// if StartTime is during another activity on the same day
} else if ($row["StartTime"] < $startTime && $row["EndTime"] > $startTime && $day == $row["Day"]) {
$errors++;
echo '<p ' . $redTextError . '>Een andere activiteit is al geregistreerd om gemonitord te worden tijdens uw opgegeven Begintijd (' . $row["Activity"] . ').</p>';
......@@ -209,7 +217,14 @@ else {
// Sql query to insert and check each variable with mysqli_real_escape_string()
$sql = sprintf("INSERT INTO Leefpatroon (StartTime, EndTime, Activity, Movement, Day, Comment, OuderID)
VALUES( '%s', '%s', '%s', '%s', '%s', '%s', '%s')", mysqli_real_escape_string($conn, $startTime), mysqli_real_escape_string($conn, $endTime), mysqli_real_escape_string($conn, $activity), mysqli_real_escape_string($conn, $movement), mysqli_real_escape_string($conn, $day), mysqli_real_escape_string($conn, $comment), mysqli_real_escape_string($conn, $OuderID));
VALUES( '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
mysqli_real_escape_string($conn, $startTime),
mysqli_real_escape_string($conn, $endTime),
mysqli_real_escape_string($conn, $activity),
mysqli_real_escape_string($conn, $movement),
mysqli_real_escape_string($conn, $day),
mysqli_real_escape_string($conn, $comment),
mysqli_real_escape_string($conn, $OuderID));
// run the query
if (!mysqli_query($conn, $sql)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment