Updated report system to analyse subsets

This commit is contained in:
2025-06-01 20:46:42 +01:00
parent 7d571d240d
commit bf17427cc4
8 changed files with 84 additions and 21 deletions

40
db.php
View File

@@ -130,10 +130,50 @@ $stmt = $pdo->prepare("
'text' => $text,
'value' => $value
]);
if ($qid == "QID68"){
updateResponseQ1($pdo, $value, $responseId);
}
if ($qid == "QID69"){
updateResponseQ2($pdo, $value, $responseId);
}
if ($qid == "QID70"){
updateResponseQ3($pdo, $value, $responseId);
}
}
}
}
function updateResponseQ1(PDO $pdo, int $q1Value, string $responseId): bool {
$sql = "UPDATE Responses SET Q1 = :q1 WHERE id = :responseId";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':q1', $q1Value, PDO::PARAM_INT);
$stmt->bindParam(':responseId', $responseId, PDO::PARAM_STR);
return $stmt->execute();
}
function updateResponseQ2(PDO $pdo, int $q2Value, string $responseId): bool {
$sql = "UPDATE Responses SET Q2 = :q2 WHERE id = :responseId";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':q2', $q2Value, PDO::PARAM_INT);
$stmt->bindParam(':responseId', $responseId, PDO::PARAM_STR);
return $stmt->execute();
}
function updateResponseQ3(PDO $pdo, int $q3Value, string $responseId): bool {
$sql = "UPDATE Responses SET Q3 = :q3 WHERE id = :responseId";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':q3', $q3Value, PDO::PARAM_INT);
$stmt->bindParam(':responseId', $responseId, PDO::PARAM_STR);
return $stmt->execute();
}
?>