School Management System Project With Source Code In Php [NEW]

The School Management System (SMS) is a web-based application built in PHP and MySQL designed to automate the daily operations of a school. It manages students, teachers, classes, attendance, fees, exams, and grades. This system eliminates paperwork, reduces manual errors, and provides a centralized dashboard for administrators, teachers, students, and parents.

Key benefits:


// marksheet.php
$student_id = $_GET['student_id'];
$exam = $_GET['exam_type'];

$sql = "SELECT subjects.name, marks.marks_obtained, marks.max_marks FROM marks JOIN subjects ON marks.subject_id = subjects.id WHERE marks.student_id = $student_id AND marks.exam_type='$exam'";

$result = mysqli_query($conn, $sql); $total_obtained = 0; $total_max = 0; school management system project with source code in php

while($row = mysqli_fetch_assoc($result)) echo $row['name'] . ": " . $row['marks_obtained'] . "/" . $row['max_marks'] . "<br>"; $total_obtained += $row['marks_obtained']; $total_max += $row['max_marks']; $percentage = ($total_obtained / $total_max) * 100; echo "<strong>Total: $total_obtained/$total_max (" . round($percentage,2) . "%)</strong>";

File: modules/teacher/attendance.php

<?php
require_once '../../config/database.php';
$class_id = $_GET['class_id'] ?? 1;
$date = date('Y-m-d');

// Fetch students of this class $stmt = $pdo->prepare("SELECT s.student_id, s.first_name, s.last_name FROM students s WHERE s.class_id = ?"); $stmt->execute([$class_id]); $students = $stmt->fetchAll();

if ($_SERVER['REQUEST_METHOD'] == 'POST') foreach ($_POST['attendance'] as $student_id => $status) $insert = $pdo->prepare("INSERT INTO attendance (student_id, date, status, class_id) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE status = ?"); $insert->execute([$student_id, $date, $status, $class_id, $status]); $msg = "Attendance saved!"; ?>

School Management System (PHP & MySQL)

CREATE TABLE users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(100) UNIQUE,
  password_hash VARCHAR(255),
  role ENUM('admin','teacher','student') NOT NULL,
  name VARCHAR(150),
  email VARCHAR(150)
);
CREATE TABLE students (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT,
  student_number VARCHAR(50) UNIQUE,
  dob DATE,
  class_id INT
);
-- add other tables similarly...
school-management-system/
│
├── assets/
│   ├── css/ (custom styles, Bootstrap)
│   ├── js/  (custom JS, jQuery)
│   └── images/
│
├── config/
│   └── database.php (DB connection)
│
├── includes/
│   ├── header.php
│   ├── footer.php
│   ├── sidebar.php
│   └── auth.php (session validation)
│
├── modules/
│   ├── admin/
│   │   ├── dashboard.php
│   │   ├── manage_students.php
│   │   ├── manage_teachers.php
│   │   └── ...
│   ├── teacher/
│   │   ├── attendance.php
│   │   ├── marks_entry.php
│   │   └── ...
│   ├── student/
│   │   ├── view_attendance.php
│   │   ├── view_results.php
│   │   └── ...
│   └── parent/
│       ├── child_attendance.php
│       └── fee_status.php
│
├── login.php
├── logout.php
├── index.php (redirects to login or dashboard)
└── README.md

A well-structured database is the heart of any school management system. Below is the essential schema with table names and relationships.