A simple Library Management Module built using core PHP and MySQL.
- Manage students (
students.php) - Manage books (
books.php) - Issue books (
issue_book.php) - Return books (
issue_book.php) - Borrow report with date filter (
report_book.php)
- Ability to create students and books.
- A student can borrow a maximum of 3 active books at a time.
- If a book is already taken, another student cannot borrow the same book.
- When a book is issued, the due date is automatically calculated as 14 days from the issue date.
- Books can be returned.
library-management-module/
├── index.php
├── students.php
├── books.php
├── issue_book.php
├── report_book.php
├── config/
│ └── db.php
├── includes/
│ ├── header.php
│ ├── footer.php
│ └── functions.php
└── sql/
└── library_management.sql
- PHP 8.0+ (PHP 7.4+ should also work with small adjustments)
- MySQL 5.7+ or MySQL 8+
- Apache server (XAMPP / WAMP / Laragon / MAMP are fine)
For XAMPP:
- Windows:
C:/xampp/htdocs/ - Linux:
/opt/lampp/htdocs/
Example final path:
htdocs/library-management-module/
Start both services from your local server control panel.
Open phpMyAdmin or MySQL CLI and run:
SOURCE sql/library_management.sql;Or paste the SQL file contents manually into phpMyAdmin.
Open config/db.php and update if needed:
$host = 'localhost';
$db = 'library_management';
$user = 'root';
$pass = '';Open in browser:
http://localhost/library-management-module/
- Open
students.php - Add student name, roll number, and class
- Open
books.php - Add book title, author name, and ISBN
- Open
issue_book.php - Select a student
- Select an available book
- Click Issue Book
- The system checks:
- Student active borrow count must be less than 3
- Book must not already be issued
- After successful issue, the system shows the due date
- In the active issues table, click Return
- The system sets
return_dateto the current date
- Open
report_book.php - Select
From DateandTo Date - View all borrowing records in that date range with calculated due dates
- Due date is stored during issue time.
- Returned books become available again for future borrowing.
- Unique constraints are added on roll number and ISBN.
- The UI is intentionally simple and beginner-friendly.
- Add edit and delete actions for students and books
- Add login authentication for librarian/admin
- Add overdue report
- Add search and pagination
- Add Bootstrap or improved UI styling
- Add server-side validations for date ranges and duplicate actions
This project is designed to be easy to understand for fresher-level backend developers learning PHP with MySQL.