prepare("SELECT * FROM students WHERE roll_no = ?"); $stmt->bind_param("s", $roll_no); $stmt->execute(); $student_res = $stmt->get_result(); $student = $student_res->fetch_assoc(); if ($student) { $student_id = $student['id']; $verification_status = true; // --- DYNAMIC CLASS TITLE LOGIC --- // Agar class 12 hai to Secondary, warna Matriculation $student_class = trim($student['class']); if ($student_class == '12' || $student_class == '12th') { $class_title = "SENIOR SECONDARY (10+2) EXAMINATION"; } else { $class_title = "MATRICULATION (10th CLASS) EXAMINATION"; } // 2. Fetch Serial Number $cert_res = $conn->query("SELECT serial_no FROM certificates WHERE student_id = $student_id AND certificate_type = 'marksheet'"); $cert_data = $cert_res ? $cert_res->fetch_assoc() : null; $serial_no = $cert_data ? preg_replace('/[^0-9]/', '', $cert_data['serial_no']) : 'N/A'; // 3. Fetch Marks $marks_query = "SELECT s.subject_name, m.marks_obtained as theory, m.practical_marks, s.max_marks, m.exam_year, m.date_of_issue FROM marks m JOIN subjects s ON m.subject_id = s.id WHERE m.student_id = $student_id ORDER BY s.id ASC"; $marks_res = $conn->query($marks_query); $total_obtained = 0; $total_max = 0; if ($marks_res && $marks_res->num_rows > 0) { while($row = $marks_res->fetch_assoc()) { $marks_list[] = $row; $total_obtained += (intval($row['theory']) + intval($row['practical_marks'])); $total_max += intval($row['max_marks']); $doi_raw = $row['date_of_issue']; $exam_year_val = $row['exam_year']; } } $exam_session = $exam_year_val . " (REGULAR)"; $date_of_issue = date('d-m-Y', strtotime($doi_raw)); // Division logic $perc = ($total_max > 0) ? ($total_obtained / $total_max) * 100 : 0; $division = ($perc >= 60) ? "FIRST DIVISION" : (($perc >= 45) ? "SECOND DIVISION" : "THIRD DIVISION"); // PHOTO PATH $photo_name = trim($student['photo']); $photo_path = "admin/uploads/photos/" . $photo_name; if (empty($photo_name) || !file_exists($photo_path)) { $photo_path = "admin/" . $student['photo_path']; } if (!file_exists($photo_path) || empty($student['photo'] . $student['photo_path'])) { $photo_path = "assets/img/default-avatar.png"; } } } $bg_image = "admin/uploads/backgrounds/verify_bg.jpg"; ?> Verify - <?= htmlspecialchars($roll_no) ?>



Photo
:
:
:
:
:
:
:
Sr.No SUBJECTS MAX MARKS MARKS OBTAINED TOTAL
THEORY PRACTICAL
0) ? $m['practical_marks'] : '--' ?>
GRAND TOTAL & RESULT PASS /
Barcode

Invalid Roll Number!