Skip to content

Latest commit

 

History

History
146 lines (102 loc) · 3.21 KB

File metadata and controls

146 lines (102 loc) · 3.21 KB

Library Management Module (PHP + MySQL)

A simple Library Management Module built using core PHP and MySQL.

Features

  • 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)

Implemented Business Rules

  1. Ability to create students and books.
  2. A student can borrow a maximum of 3 active books at a time.
  3. If a book is already taken, another student cannot borrow the same book.
  4. When a book is issued, the due date is automatically calculated as 14 days from the issue date.
  5. Books can be returned.

Project Structure

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

Requirements

  • 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)

Setup Steps

1. Copy project into server folder

For XAMPP:

  • Windows: C:/xampp/htdocs/
  • Linux: /opt/lampp/htdocs/

Example final path:

htdocs/library-management-module/

2. Start Apache and MySQL

Start both services from your local server control panel.

3. Create database tables

Open phpMyAdmin or MySQL CLI and run:

SOURCE sql/library_management.sql;

Or paste the SQL file contents manually into phpMyAdmin.

4. Configure database connection

Open config/db.php and update if needed:

$host = 'localhost';
$db   = 'library_management';
$user = 'root';
$pass = '';

5. Run the project

Open in browser:

http://localhost/library-management-module/

How to Use

Manage Students

  • Open students.php
  • Add student name, roll number, and class

Manage Books

  • Open books.php
  • Add book title, author name, and ISBN

Issue Book

  • 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

Return Book

  • In the active issues table, click Return
  • The system sets return_date to the current date

Report

  • Open report_book.php
  • Select From Date and To Date
  • View all borrowing records in that date range with calculated due dates

Important Notes

  • 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.

Suggested Improvements

  • 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

Authoring Notes

This project is designed to be easy to understand for fresher-level backend developers learning PHP with MySQL.