This is a simple Library Management System created using HTML, CSS, JavaScript, PHP, and MySQL. The project is designed to run on XAMPP and helps manage books in a small library. You can add, edit, delete, search, and view books through a clean and responsive interface.
- HTML5
- CSS3
- JavaScript
- PHP
- MySQL
- XAMPP
- Dashboard with library statistics
- Add new books
- View all books
- Edit book details
- Delete books with a confirmation message
- Search books by title, author, or category
- Responsive blue and white user interface
- Form validation using JavaScript and PHP
- Secure database queries using prepared statements
library-management/
│
├── config/
│ └── db.php
│
├── css/
│ └── style.css
│
├── js/
│ └── script.js
│
├── index.php
├── add.php
├── edit.php
├── delete.php
├── search.php
├── library_db.sql
└── README.md
Copy the project folder into the XAMPP htdocs folder.
C:\xampp\htdocs\library-management
Open XAMPP and start:
- Apache
- MySQL
Open your browser and go to:
http://localhost/phpmyadmin
Import the database.
- Create a database named library_db (optional).
- Click the Import tab.
- Select the
library_db.sqlfile. - Click Go.
The books table and sample records will be created automatically.
Open the project in your browser.
http://localhost/library-management/
The Library Management System should now be ready to use.
The database connection is inside:
config/db.php
Default settings are:
$host = "localhost";
$user = "root";
$password = "";
$database = "library_db";If your MySQL password is different, update the $password value.
books
| Column | Type |
|---|---|
| id | INT |
| title | VARCHAR(255) |
| author | VARCHAR(255) |
| category | VARCHAR(100) |
| quantity | INT |
The system checks that:
- All fields are required.
- Quantity must be a whole number.
- Validation is done in both JavaScript and PHP.
- Prepared statements are used to prevent SQL injection.
htmlspecialchars()is used to display data safely.- Search input is checked before running queries.