prepare("SELECT name FROM users WHERE id = ?"); $user_stmt->execute([$user_id]); $user_name = $user_stmt->fetchColumn(); // Fetch skill title $skill_stmt = $db->prepare("SELECT title FROM skills WHERE id = ?"); $skill_stmt->execute([$skill_id]); $skill_title = $skill_stmt->fetchColumn(); // Fetch latest quiz attempt with a score of 70% or higher $attempt_stmt = $db->prepare("SELECT score, completed_at FROM quiz_attempts WHERE user_id = ? AND skill_id = ? AND score >= 70 ORDER BY completed_at DESC LIMIT 1"); $attempt_stmt->execute([$user_id, $skill_id]); $attempt = $attempt_stmt->fetch(PDO::FETCH_ASSOC); if (!$user_name || !$skill_title || !$attempt) { // Redirect or show an error if the user is not eligible for a certificate header('Location: dashboard.php?error=not_eligible'); exit; } $completion_date = date("F j, Y", strtotime($attempt['completed_at'])); ?> Certificate of Completion
Certificate of Completion
This is to certify that
has successfully completed the skill
""
on
Back to Dashboard