Invalid test ID.
"; require_once 'includes/footer.php'; exit(); } $test_id = intval($_GET['test_id']); $user_id = $_SESSION['user_id']; try { $db = db(); // Fetch test details $stmt = $db->prepare("SELECT title FROM tests WHERE id = :id"); $stmt->execute(['id' => $test_id]); $test = $stmt->fetch(PDO::FETCH_ASSOC); if (!$test) { echo "
Test not found.
"; require_once 'includes/footer.php'; exit(); } // Fetch user's score $scoreStmt = $db->prepare("SELECT score FROM user_tests WHERE user_id = :user_id AND test_id = :test_id"); $scoreStmt->execute(['user_id' => $user_id, 'test_id' => $test_id]); $result = $scoreStmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { die("Database error: " . $e->getMessage()); } ?>

Results for

Your Score:

This score reflects your responses to the test questions.

We couldn't find your results for this test. Please make sure you have completed it.