begin_transaction(); try { // Check if subjects exist, if not add them $subjects = [ ['10', 'Punjabi', 'ਪੰਜਾਬੀ', 100, 33], ['10', 'English', 'ਅੰਗਰੇਜ਼ੀ', 100, 33], ['10', 'Mathematics', 'ਗਣਿਤ', 100, 33], ['10', 'Science', 'ਵਿਗਿਆਨ', 100, 33], ['10', 'Social Studies', 'ਸਮਾਜਿਕ ਅਧਿਐਨ', 100, 33], ['10', 'Computer Science', 'ਕੰਪਿਊਟਰ ਵਿਗਿਆਨ', 100, 33], ['10', 'Hindi', 'ਹਿੰਦੀ', 100, 33] ]; foreach ($subjects as $subject) { $check = $conn->query("SELECT id FROM subjects WHERE class='10' AND subject_name='$subject[1]'"); if ($check->num_rows == 0) { $stmt = $conn->prepare("INSERT INTO subjects (class, subject_name, subject_name_pb, max_marks, passing_marks) VALUES (?, ?, ?, ?, ?)"); $stmt->bind_param("sssii", $subject[0], $subject[1], $subject[2], $subject[3], $subject[4]); $stmt->execute(); } } // Sample students data $students = [ ['Gurpreet Singh', 'ਗੁਰਪ੍ਰੀਤ ਸਿੰਘ', 'Balwinder Singh', 'ਬਲਵਿੰਦਰ ਸਿੰਘ', 'Jaswinder Kaur', 'ਜਸਵਿੰਦਰ ਕੌਰ', '102355001', 'PB550240001', '2008-05-15', '2023-04-01', 'Annual', '10', 'Government High School, Ludhiana'], ['Harpreet Kaur', 'ਹਰਪ੍ਰੀਤ ਕੌਰ', 'Gurdev Singh', 'ਗੁਰਦੇਵ ਸਿੰਘ', 'Simran Kaur', 'ਸਿਮਰਨ ਕੌਰ', '102355002', 'PB550240002', '2008-08-22', '2023-04-01', 'Annual', '10', 'Sacred Heart Convent School, Jalandhar'], ['Amanjot Singh', 'ਅਮਨਜੋਤ ਸਿੰਘ', 'Sukhdev Singh', 'ਸੁਖਦੇਵ ਸਿੰਘ', 'Baljit Kaur', 'ਬਲਜੀਤ ਕੌਰ', '102355003', 'PB550240003', '2007-12-10', '2023-04-01', 'Annual', '10', 'DAV Public School, Amritsar'], ['Simranjeet Kaur', 'ਸਿਮਰਨਜੀਤ ਕੌਰ', 'Jaswinder Singh', 'ਜਸਵਿੰਦਰ ਸਿੰਘ', 'Manjit Kaur', 'ਮਨਜੀਤ ਕੌਰ', '102355004', 'PB550240004', '2008-03-18', '2023-04-01', 'Annual', '10', 'Spring Dale School, Patiala'], ['Navdeep Singh', 'ਨਵਦੀਪ ਸਿੰਘ', 'Kulwinder Singh', 'ਕੁਲਵਿੰਦਰ ਸਿੰਘ', 'Sukhjit Kaur', 'ਸੁਖਜੀਤ ਕੌਰ', '102355005', 'PB550240005', '2007-09-05', '2023-04-01', 'Annual', '10', 'St. Joseph School, Bathinda'], ['Jaspreet Kaur', 'ਜਸਪ੍ਰੀਤ ਕੌਰ', 'Mandeep Singh', 'ਮਨਦੀਪ ਸਿੰਘ', 'Gurpreet Kaur', 'ਗੁਰਪ੍ਰੀਤ ਕੌਰ', '102355006', 'PB550240006', '2008-01-12', '2023-04-01', 'Winter', '10', 'Guru Nanak Public School, Sangrur'], ['Manpreet Singh', 'ਮਨਪ੍ਰੀਤ ਸਿੰਘ', 'Harjinder Singh', 'ਹਰਜਿੰਦਰ ਸਿੰਘ', 'Kamaljit Kaur', 'ਕਮਲਜੀਤ ਕੌਰ', '102355007', 'PB550240007', '2007-07-25', '2023-04-01', 'Annual', '10', 'Government School, Moga'], ['Rajdeep Kaur', 'ਰਾਜਦੀਪ ਕੌਰ', 'Sukhwinder Singh', 'ਸੁਖਵਿੰਦਰ ਸਿੰਘ', 'Paramjit Kaur', 'ਪਰਮਜੀਤ ਕੌਰ', '102355008', 'PB550240008', '2008-04-30', '2023-04-01', 'Summer', '10', 'Cambridge International School, Phagwara'], ['Gaganpreet Singh', 'ਗਗਨਪ੍ਰੀਤ ਸਿੰਘ', 'Baldev Singh', 'ਬਲਦੇਵ ਸਿੰਘ', 'Surjit Kaur', 'ਸੁਰਜੀਤ ਕੌਰ', '102355009', 'PB550240009', '2007-11-08', '2023-04-01', 'Annual', '10', 'Police DAV School, Jalandhar'], ['Amandeep Kaur', 'ਅਮਨਦੀਪ ਕੌਰ', 'Gurmail Singh', 'ਗੁਰਮੇਲ ਸਿੰਘ', 'Kuldeep Kaur', 'ਕੁਲਦੀਪ ਕੌਰ', '102355010', 'PB550240010', '2008-06-20', '2023-04-01', 'Annual', '10', 'BVM School, Ludhiana'] ]; // Clear existing students (optional - comment if you want to keep existing) // $conn->query("DELETE FROM students WHERE class='10'"); foreach ($students as $student) { $stmt = $conn->prepare("INSERT INTO students (student_name, student_name_pb, father_name, father_name_pb, mother_name, mother_name_pb, roll_no, reg_no, date_of_birth, date_of_admission, season, class, school_centre) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param("sssssssssssss", $student[0], $student[1], $student[2], $student[3], $student[4], $student[5], $student[6], $student[7], $student[8], $student[9], $student[10], $student[11], $student[12]); $stmt->execute(); } // Marks data for annual exam $annual_marks = [ // Student 1 marks [1, 'Punjabi', 85], [1, 'English', 78], [1, 'Mathematics', 92], [1, 'Science', 88], [1, 'Social Studies', 76], [1, 'Computer Science', 95], [1, 'Hindi', 82], // Student 2 marks [2, 'Punjabi', 95], [2, 'English', 88], [2, 'Mathematics', 76], [2, 'Science', 92], [2, 'Social Studies', 89], [2, 'Computer Science', 91], [2, 'Hindi', 94], // Student 3 marks [3, 'Punjabi', 72], [3, 'English', 68], [3, 'Mathematics', 88], [3, 'Science', 79], [3, 'Social Studies', 71], [3, 'Computer Science', 84], [3, 'Hindi', 69], // Student 4 marks [4, 'Punjabi', 91], [4, 'English', 86], [4, 'Mathematics', 94], [4, 'Science', 89], [4, 'Social Studies', 92], [4, 'Computer Science', 96], [4, 'Hindi', 88], // Student 5 marks [5, 'Punjabi', 67], [5, 'English', 71], [5, 'Mathematics', 58], [5, 'Science', 62], [5, 'Social Studies', 73], [5, 'Computer Science', 69], [5, 'Hindi', 64], // Student 6 marks [6, 'Punjabi', 88], [6, 'English', 92], [6, 'Mathematics', 85], [6, 'Science', 90], [6, 'Social Studies', 87], [6, 'Computer Science', 93], [6, 'Hindi', 89], // Student 7 marks [7, 'Punjabi', 78], [7, 'English', 74], [7, 'Mathematics', 82], [7, 'Science', 79], [7, 'Social Studies', 71], [7, 'Computer Science', 77], [7, 'Hindi', 75], // Student 8 marks [8, 'Punjabi', 96], [8, 'English', 94], [8, 'Mathematics', 98], [8, 'Science', 95], [8, 'Social Studies', 93], [8, 'Computer Science', 97], [8, 'Hindi', 92], // Student 9 marks [9, 'Punjabi', 69], [9, 'English', 65], [9, 'Mathematics', 72], [9, 'Science', 68], [9, 'Social Studies', 71], [9, 'Computer Science', 74], [9, 'Hindi', 63], // Student 10 marks [10, 'Punjabi', 87], [10, 'English', 83], [10, 'Mathematics', 79], [10, 'Science', 85], [10, 'Social Studies', 81], [10, 'Computer Science', 88], [10, 'Hindi', 84] ]; foreach ($annual_marks as $mark) { $subject_id = $conn->query("SELECT id FROM subjects WHERE class='10' AND subject_name='{$mark[1]}'")->fetch_assoc()['id']; $stmt = $conn->prepare("INSERT INTO marks (student_id, subject_id, marks_obtained, exam_year, exam_type) VALUES (?, ?, ?, 2024, 'Annual')"); $stmt->bind_param("iii", $mark[0], $subject_id, $mark[2]); $stmt->execute(); } // Add half yearly marks for first 2 students $half_yearly_marks = [ [1, 'Punjabi', 82], [1, 'English', 75], [1, 'Mathematics', 88], [1, 'Science', 84], [1, 'Social Studies', 73], [2, 'Punjabi', 92], [2, 'English', 85], [2, 'Mathematics', 74], [2, 'Science', 89], [2, 'Social Studies', 86] ]; foreach ($half_yearly_marks as $mark) { $subject_id = $conn->query("SELECT id FROM subjects WHERE class='10' AND subject_name='{$mark[1]}'")->fetch_assoc()['id']; $stmt = $conn->prepare("INSERT INTO marks (student_id, subject_id, marks_obtained, exam_year, exam_type) VALUES (?, ?, ?, 2024, 'Half Yearly')"); $stmt->bind_param("iii", $mark[0], $subject_id, $mark[2]); $stmt->execute(); } // Update counters $conn->query("UPDATE counters SET last_number = 10 WHERE counter_type = 'roll_10' AND year = 2024"); $conn->query("UPDATE counters SET last_number = 10 WHERE counter_type = 'registration' AND year = 2024"); // Log activity logActivity('Added Sample Data', 'Added 10 sample students for Class 10 with marks'); $conn->commit(); $message = "10 sample students added successfully with their marks!"; } catch (Exception $e) { $conn->rollback(); $error = "Error adding sample data: " . $e->getMessage(); } } // Include header and sidebar $page_title = 'Add Sample Data'; include 'includes/header.php'; include 'includes/sidebar.php'; ?>

Add Sample Students

Add 10 sample students for Class 10 with their marks

Back to Students

Sample Students Information:

  • 10 students will be added to Class 10
  • Each student has 7 subjects (Punjabi, English, Mathematics, Science, Social Studies, Computer Science, Hindi)
  • Annual Exam 2024 marks for all students
  • Half Yearly 2024 marks for first 2 students
  • Auto-generated Roll Numbers: 102355001 to 102355010
  • Auto-generated Registration Numbers: PB550240001 to PB550240010

Preview of Students to be Added:

Roll No Student Name Father's Name Class School/Centre
102355001Gurpreet SinghBalwinder Singh10Govt High School, Ludhiana
102355002Harpreet KaurGurdev Singh10Sacred Heart Convent, Jalandhar
102355003Amanjot SinghSukhdev Singh10DAV Public School, Amritsar
102355004Simranjeet KaurJaswinder Singh10Spring Dale School, Patiala
102355005Navdeep SinghKulwinder Singh10St. Joseph School, Bathinda
102355006Jaspreet KaurMandeep Singh10Guru Nanak Public School, Sangrur
102355007Manpreet SinghHarjinder Singh10Government School, Moga
102355008Rajdeep KaurSukhwinder Singh10Cambridge International, Phagwara
102355009Gaganpreet SinghBaldev Singh10Police DAV School, Jalandhar
102355010Amandeep KaurGurmail Singh10BVM School, Ludhiana