School Management System Project: With Source Code In Php Fixed
A School Management System (SMS) is a comprehensive web-based platform designed to automate and streamline the administrative, academic, and financial operations of educational institutions. Building this system using PHP and MySQL is a popular choice due to PHP’s open-source nature, platform independence, and robust database connectivity. Core Modules and Features
A functional SMS typically includes distinct portals for different user roles to ensure security and task-specific access. ProjectsAndPrograms/school-management-system - GitHub
Project Structure (Folder Organization)
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
Sample SQL for Two Key Tables
CREATE DATABASE school_management; USE school_management;-- Users table CREATE TABLE users ( user_id INT(11) AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) UNIQUE NOT NULL, password VARCHAR(255) NOT NULL, email VARCHAR(100), role ENUM('admin','teacher','student','parent') DEFAULT 'student', status TINYINT(1) DEFAULT 1 );
-- Students table CREATE TABLE students ( student_id INT(11) AUTO_INCREMENT PRIMARY KEY, user_id INT(11), admission_no VARCHAR(20) UNIQUE, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(50) NOT NULL, dob DATE, gender ENUM('Male','Female','Other'), phone VARCHAR(15), address TEXT, class_id INT(11), section_id INT(11), parent_id INT(11), FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE );
Full SQL schema with all 12 tables and foreign keys is provided in the downloadable source code package.
Database Design (ER Diagram & Tables)
Let's create the necessary tables. Below is the SQL schema for our School Management System:
CREATE DATABASE school_management; USE school_management;-- 1. Admins table CREATE TABLE admins ( id INT(11) AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, email VARCHAR(100), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-- 2. Classes table CREATE TABLE classes ( id INT(11) AUTO_INCREMENT PRIMARY KEY, class_name VARCHAR(50) NOT NULL, section VARCHAR(10) NOT NULL ); school management system project with source code in php
-- 3. Subjects table CREATE TABLE subjects ( id INT(11) AUTO_INCREMENT PRIMARY KEY, subject_name VARCHAR(100) NOT NULL, class_id INT(11), FOREIGN KEY (class_id) REFERENCES classes(id) ON DELETE CASCADE );
-- 4. Students table CREATE TABLE students ( id INT(11) AUTO_INCREMENT PRIMARY KEY, student_name VARCHAR(100) NOT NULL, roll_no VARCHAR(20) NOT NULL, class_id INT(11), parent_mobile VARCHAR(15), address TEXT, password VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (class_id) REFERENCES classes(id) ON DELETE SET NULL );
-- 5. Teachers table CREATE TABLE teachers ( id INT(11) AUTO_INCREMENT PRIMARY KEY, teacher_name VARCHAR(100) NOT NULL, email VARCHAR(100) UNIQUE, mobile VARCHAR(15), subject_id INT(11), class_id INT(11), password VARCHAR(255) NOT NULL, FOREIGN KEY (subject_id) REFERENCES subjects(id), FOREIGN KEY (class_id) REFERENCES classes(id) );
-- 6. Attendance table CREATE TABLE attendance ( id INT(11) AUTO_INCREMENT PRIMARY KEY, student_id INT(11), class_id INT(11), date DATE, status ENUM('Present', 'Absent', 'Late'), FOREIGN KEY (student_id) REFERENCES students(id), FOREIGN KEY (class_id) REFERENCES classes(id) ); A School Management System (SMS) is a comprehensive
-- 7. Exam marks table CREATE TABLE exam_marks ( id INT(11) AUTO_INCREMENT PRIMARY KEY, student_id INT(11), subject_id INT(11), marks_obtained INT(11), exam_name VARCHAR(50) -- e.g., Midterm, Final FOREIGN KEY (student_id) REFERENCES students(id), FOREIGN KEY (subject_id) REFERENCES subjects(id) );
-- 8. Fees table CREATE TABLE fees ( id INT(11) AUTO_INCREMENT PRIMARY KEY, student_id INT(11), amount DECIMAL(10,2), payment_date DATE, status ENUM('Paid', 'Pending'), FOREIGN KEY (student_id) REFERENCES students(id) );
-- Insert default admin INSERT INTO admins (username, password, email) VALUES ('admin', MD5('admin123'), 'admin@school.com');
Note: In production, use
password_hash()instead of MD5.