$con) if (!isset($con)) { if (isset($conn)) { $con = $conn; } elseif (isset($db)) { $con = $db; } elseif (isset($mysqli)) { $con = $mysqli; } elseif (isset($link)) { $con = $link; } } // Connection check if (!isset($con) || !$con) { die("

⚠️ Database Connection Error!

includes/config.php se database connect nahi ho pa raha hai.

"); } $enroll_no = $_GET['enrollment_no'] ?? ''; $enroll_clean = mysqli_real_escape_string($con, $enroll_no); // Fetch Migration Details $mig = []; if (!empty($enroll_clean)) { $mig_q = $con->query("SELECT * FROM migrations WHERE enrollment_no = '$enroll_clean'"); if ($mig_q && $mig_q->num_rows > 0) { $mig = $mig_q->fetch_assoc(); } } // Fetch Student Details $st = []; if (!empty($enroll_clean)) { $st_q = $con->query("SELECT * FROM students WHERE enrollment_no = '$enroll_clean'"); if ($st_q && $st_q->num_rows > 0) { $st = $st_q->fetch_assoc(); } } // Fetch Results (for roll_no AND session/exam details) $res = []; $exam_month_year = ''; if (!empty($enroll_clean)) { $res_q = $con->query("SELECT * FROM results WHERE enrollment_no = '$enroll_clean' LIMIT 1"); if ($res_q && $res_q->num_rows > 0) { $res = $res_q->fetch_assoc(); } } // Background Image Path Detection $bg_img = 'format/migration.jpg'; if (!file_exists($bg_img) && file_exists('../format/migration.jpg')) { $bg_img = '../format/migration.jpg'; } // Dynamic Variables $name = $st['name'] ?? ''; $father = $st['father_name'] ?? ($st['father'] ?? ''); $mother = $st['mother'] ?? ($st['mother_name'] ?? ''); $dob = $st['dob'] ?? ($mig['dob'] ?? ''); $center_name = !empty($st['center_name']) ? $st['center_name'] : 'Gujarat State Open School (GSOS)'; $course_name = !empty($st['course_name']) ? $st['course_name'] : 'Secondary / Higher Secondary Certificate Examination'; $issue_date = !empty($mig['issue_date']) ? date('d-m-Y', strtotime($mig['issue_date'])) : date('d-m-Y'); $roll_no = $res['roll_no'] ?? ($st['roll_no'] ?? 'N/A'); $place = $st['place'] ?? 'AHMEDABAD'; // ============ FIXED: Exam Month/Year from results.session (SAME AS MARKSHEET) ============ $session = $res['session'] ?? $mig['session'] ?? $st['session'] ?? ''; if (!empty($session)) { // Session format: "March 2025" ya "April 2024" etc. $session_parts = explode(' ', trim($session)); $exam_month = $session_parts[0] ?? 'March'; $exam_year = $session_parts[1] ?? date('Y'); $exam_month_year = $exam_month . ' - ' . $exam_year; } else { // Agar session nahi mila to fallback $exam_month_year = 'March - ' . date('Y'); } // Function for Date in Words function dateToWords($dateStr) { if (empty($dateStr)) return ''; $time = strtotime($dateStr); if (!$time) return ''; $day = (int)date('d', $time); $month = date('F', $time); $year = (int)date('Y', $time); $ones = [ 1 => 'One', 2 => 'Two', 3 => 'Three', 4 => 'Four', 5 => 'Five', 6 => 'Six', 7 => 'Seven', 8 => 'Eight', 9 => 'Nine', 10 => 'Ten', 11 => 'Eleven', 12 => 'Twelve', 13 => 'Thirteen', 14 => 'Fourteen', 15 => 'Fifteen', 16 => 'Sixteen', 17 => 'Seventeen', 18 => 'Eighteen', 19 => 'Nineteen' ]; $tens = [ 2 => 'Twenty', 3 => 'Thirty', 4 => 'Forty', 5 => 'Fifty' ]; if ($day < 20) { $dayStr = $ones[$day] ?? $day; } else { $d1 = (int)($day / 10); $d2 = $day % 10; $dayStr = $tens[$d1] . ($d2 > 0 ? ' ' . $ones[$d2] : ''); } $yearStr = ''; if ($year >= 2000 && $year < 2100) { $yRem = $year - 2000; if ($yRem == 0) { $yearStr = 'Two Thousand'; } elseif ($yRem < 20) { $yearStr = 'Two Thousand ' . ($ones[$yRem] ?? ''); } else { $y1 = (int)($yRem / 10); $y2 = $yRem % 10; $yearStr = 'Two Thousand ' . $tens[$y1] . ($y2 > 0 ? ' ' . $ones[$y2] : ''); } } else { $yearStr = $year; } return trim("$dayStr $month $yearStr"); } $dob_in_words = dateToWords($dob); $formatted_dob = !empty($dob) ? date('d-m-Y', strtotime($dob)) : ''; ?> Migration Certificate - <?= htmlspecialchars($enroll_no) ?>
Background Migration Frame
This is to certify that
Son/Daughter of Shri. and Mrs.
Date of Birth :
()
School/Centre :
The above candidate has successfully passed the
held in the month of and is hereby granted
this Migration Certificate for admission to higher studies
or for transfer to another Board / University / Institution.
Registration No :
Roll Number :