test: otw diambil bram

This commit is contained in:
Matthew Florentino 2025-12-01 09:34:11 +07:00
parent 409d7dfe9f
commit e1af8fc497
3 changed files with 3 additions and 3 deletions

View File

@ -114,5 +114,4 @@ function postScore(score){
.then(t => console.log("Server response:", t))
.catch(err => console.error("Fetch error:", err));
}
startQuiz()

1
src/js/soal.js Normal file
View File

@ -0,0 +1 @@
dadad

View File

@ -12,14 +12,14 @@ if (!isset($data['score'])) {
}
$score = (int)$data['score'];
$user_id = isset($_SESSION['user_id']) ? (int)$_SESSION['user_id'] : null;
$user_id = isset($_SESSION['id']) ? (int)$_SESSION['id'] : null;
if (!$user_id) {
echo json_encode(["error" => "no session user"]);
exit;
}
$stmt = $db->prepare("INSERT INTO scores (user_id, score) VALUES (?, ?)");
$stmt = $db->prepare("INSERT INTO scores (id, score) VALUES (?, ?)");
$stmt->bind_param("ii", $user_id, $score);
if ($stmt->execute()) {