School Management System Project With Source Code In Php -
Building a Complete School Management System Project with Source Code in PHP
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.
6. Exam & Grade Management
- Create exams (Midterms, Finals).
- Enter marks for each subject.
- Automatic grade calculation (A+, A, B, etc.) and transcript generation.
File 2: index.php (Login System)
<?php
// index.php
require 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST")
$username = $_POST['username'];
$password = md5($_POST['password']); // Using MD5 to match the simple hash in SQL school management system project with source code in php
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0)
$row = $result->fetch_assoc();
$_SESSION['user_id'] = $row['id'];
$_SESSION['role'] = $row['role'];
$_SESSION['name'] = $row['name'];
// Redirect based on role
if($row['role'] == 'admin')
header("Location: dashboard.php");
else
header("Location: dashboard.php"); // Can be redirected to a teacher dashboard
else
$error = "Invalid Username or Password";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMS Login</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light d-flex align-items-center" style="height: 100vh;">
<div class="container col-md-4">
<
A robust system starts with a well-structured MySQL database. You will need tables for users, classes, subjects, and records.
A School Management System (SMS) built with PHP and MySQL is a web-based platform designed to automate administrative tasks like student enrollment, attendance, and grading. Popular open-source versions often use frameworks like CodeIgniter or standard Bootstrap for a responsive interface. 1. Project Source Code Resources Building a Complete School Management System Project with
You can find and download complete project source code from these reputable repositories:
GitHub: ProjectsAndPrograms/school-management-system: Features student/teacher record management, dark theme support, and notice uploads.
GitHub: lahirudanushka/PHP-MySQL-SMS: A robust implementation covering student, subject, class, exam, and attendance management.
CodeAstro: School Management System: Offers a complete CodeIgniter framework project with separate panels for Admin, Teachers, and Parents. Full SQL schema with all 12 tables and
ProjectWorlds: PHP MySQL SMS V1: A straightforward, functional version suitable for learning and customization. 2. Standard Project Report Structure
A professional project report for this system typically includes the following chapters: ProjectsAndPrograms/school-management-system - GitHub
Fee Management
- Collect fees (monthly/quarterly/yearly)
- Generate fee receipts
- Track due/pending payments
Key PHP Code Snippets (Working Examples)
Core Code Implementation
5. Sample Source Code Snippets (PHP & MySQLi)
5.2 Login System (login.php)
<?php
session_start();
include('config/db_connect.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
$username = $_POST['username'];
$password = md5($_POST['password']);
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = $conn->query($sql);
if($result->num_rows == 1)
$row = $result->fetch_assoc();
$_SESSION['user_id'] = $row['id'];
$_SESSION['role'] = $row['role'];
header("Location: dashboard.php");
else
echo "Invalid login";
?>
Building a Complete School Management System Project with Source Code in PHP
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.
6. Exam & Grade Management
- Create exams (Midterms, Finals).
- Enter marks for each subject.
- Automatic grade calculation (A+, A, B, etc.) and transcript generation.
File 2: index.php (Login System)
<?php
// index.php
require 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST")
$username = $_POST['username'];
$password = md5($_POST['password']); // Using MD5 to match the simple hash in SQL
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0)
$row = $result->fetch_assoc();
$_SESSION['user_id'] = $row['id'];
$_SESSION['role'] = $row['role'];
$_SESSION['name'] = $row['name'];
// Redirect based on role
if($row['role'] == 'admin')
header("Location: dashboard.php");
else
header("Location: dashboard.php"); // Can be redirected to a teacher dashboard
else
$error = "Invalid Username or Password";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMS Login</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light d-flex align-items-center" style="height: 100vh;">
<div class="container col-md-4">
<
A robust system starts with a well-structured MySQL database. You will need tables for users, classes, subjects, and records.
A School Management System (SMS) built with PHP and MySQL is a web-based platform designed to automate administrative tasks like student enrollment, attendance, and grading. Popular open-source versions often use frameworks like CodeIgniter or standard Bootstrap for a responsive interface. 1. Project Source Code Resources
You can find and download complete project source code from these reputable repositories:
GitHub: ProjectsAndPrograms/school-management-system: Features student/teacher record management, dark theme support, and notice uploads.
GitHub: lahirudanushka/PHP-MySQL-SMS: A robust implementation covering student, subject, class, exam, and attendance management.
CodeAstro: School Management System: Offers a complete CodeIgniter framework project with separate panels for Admin, Teachers, and Parents.
ProjectWorlds: PHP MySQL SMS V1: A straightforward, functional version suitable for learning and customization. 2. Standard Project Report Structure
A professional project report for this system typically includes the following chapters: ProjectsAndPrograms/school-management-system - GitHub
Fee Management
- Collect fees (monthly/quarterly/yearly)
- Generate fee receipts
- Track due/pending payments
Key PHP Code Snippets (Working Examples)
Core Code Implementation
5. Sample Source Code Snippets (PHP & MySQLi)
5.2 Login System (login.php)
<?php
session_start();
include('config/db_connect.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
$username = $_POST['username'];
$password = md5($_POST['password']);
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = $conn->query($sql);
if($result->num_rows == 1)
$row = $result->fetch_assoc();
$_SESSION['user_id'] = $row['id'];
$_SESSION['role'] = $row['role'];
header("Location: dashboard.php");
else
echo "Invalid login";
?>