20) { $marksheet_id = base64_decode(base64_decode($marksheet_id)); } // Clean the ID $marksheet_id = intval($marksheet_id); if ($marksheet_id <= 0) { die('

Invalid Marksheet ID

The provided marksheet ID is not valid.

ID Received: ' . htmlspecialchars($_GET['marksheet_id'] ?? $_GET['id'] ?? '') . '

'); } // Get result with student and course details $query = "SELECT r.*, s.*, c.course_name, c.duration as course_duration, c.duration_type as course_duration_type, r.id as marksheet_id, s.id as student_id FROM results r LEFT JOIN students s ON r.enrollment_no = s.enrollment_no LEFT JOIN courses c ON r.course_id = c.id WHERE r.id = '$marksheet_id'"; $result = $con->query($query); if (!$result) { die('

Database Error

' . $con->error . '

'); } if ($result->num_rows == 0) { die('

Marksheet Not Found

No result found with ID: ' . $marksheet_id . '

Please check if the result exists in the database.

'); } $__S = $result->fetch_assoc(); // Debug - uncomment to see fetched data // echo '
'; print_r($__S); echo '
'; exit; // Get institute details $institute = null; if (!empty($__S['center_id'])) { $inst_query = $con->query("SELECT * FROM centers WHERE id = '" . $__S['center_id'] . "'"); if ($inst_query && $inst_query->num_rows > 0) { $institute = $inst_query->fetch_assoc(); } } // Get course details $courseDetails = null; if (!empty($__S['course_id'])) { $course_query = $con->query("SELECT * FROM courses WHERE id = '" . $__S['course_id'] . "'"); if ($course_query && $course_query->num_rows > 0) { $courseDetails = $course_query->fetch_assoc(); } } // Set variables with fallbacks $course_name = $courseDetails['course_name'] ?? $__S['course_name'] ?? 'N/A'; $course_id = $courseDetails['id'] ?? $__S['course_id'] ?? ''; // Background image $bg = 'format/marksheet.jpg'; if (!file_exists($bg)) { $bg = '../format/marksheet.jpg'; } if (!file_exists($bg)) { $bg = 'admin/format/marksheet.jpg'; } $enroll_no = $__S['enrollment_no'] ?? 'N/A'; $serial_no = $__S['marksheet_id'] ?? $marksheet_id; $sr_no = $__S['sr_no'] ?? ''; $res = $__S['result'] ?? 'N/A'; $sex = ucwords($__S['gender'] ?? 'N/A'); $name = ucwords($__S['name'] ?? 'N/A'); $father = ucwords($__S['father'] ?? 'N/A'); $dob = !empty($__S['dob']) ? date('d-m-Y', strtotime($__S['dob'])) : 'N/A'; $mother = ucwords($__S['mother'] ?? 'N/A'); $roll_no = $__S['roll_no'] ?? 'N/A'; $center_name = $institute['institute_name'] ?? 'N/A'; $center_number = $institute['center_number'] ?? 'N/A'; $issue_date = $__S['issue_date'] ?? ''; $isu = !empty($issue_date) ? date('d-m-Y', strtotime($issue_date)) : 'N/A'; $examination = !empty($issue_date) ? date('M-Y', strtotime($issue_date)) : 'N/A'; $grade = $__S['grade'] ?? 'N/A'; $hidden_duration = $__S['duration'] ?? ''; $session = $__S['session'] ?? 'N/A'; $duration = ($__S['duration'] ?? '') . ' ' . ucwords($__S['duration_type'] ?? ''); // Photo $photo = ''; if (!empty($__S['photo'])) { $photo_path = 'uploads/students/' . $__S['photo']; if (file_exists($photo_path)) { $photo = $photo_path; } else { $photo_path = '../uploads/students/' . $__S['photo']; if (file_exists($photo_path)) { $photo = $photo_path; } } } // Superscript function function sup($i) { $i = ($i == 1) ? 'st' : (($i == 2) ? 'nd' : (($i == 3) ? 'rd' : 'th')); return '' . $i . ''; } // Include result template if (file_exists('result.php')) { include 'result.php'; } elseif (file_exists('admin/result.php')) { include 'admin/result.php'; } else { die('

Template Not Found

result.php file is missing.

Please check if the file exists in the correct location.

'); } } else { // No ID provided echo '

Marksheet Portal

No Marksheet ID Provided

Please provide a valid marksheet ID to view the result.

Example: student-marksheet.php?id=123

'; } ?>