The CS619 Library Management System is the most-often offered final year project at Virtual University, and this guide builds it completely — in PHP and MySQL — so you can both learn and submit it. You start with the SRS: who uses the system, what it must do, and the rules (14-day loans, Rs. 10 fine per late day, at most 3 books per member). Then you design the database with an ERD, write the code module by module with line-by-line explanations, test it with 20 test cases, and finish with viva questions and answers. The complete working code is included: login, dashboard, book and member management, issue and return with fine calculation. Follow the guide in order and you will have a working project and the understanding to defend it in the viva.
Library Management System — Learn + Build Guide
Course: CS619 Final Project, Virtual University of Pakistan Project: Library Management System (Top Project #1 — offered in 3 semesters: Earlier, Fall 2026 and Spring 2026) Stack: PHP + MySQL (XAMPP), as stated in the official specifications (Spring 2026: PHP, XAMPP Server; Fall 2016 "E-Library Management System": PHP, MySQL, XAMPP) How to use this guide: build the project in the order of this guide — SRS, then Design, then Coding, then Testing, then Viva preparation. Every section first explains the idea in plain English, then shows the work. The complete code is in the files beside this guide; the Coding section explains each module and shows the important code with line-by-line notes.
1. Project overview — what you are building
A library keeps its records in registers: who took which book, when it is due back, and who has to pay a fine. That is slow, and records get lost. This system replaces the registers with a web application.
What the system does
- The librarian (admin) adds books to the catalogue, registers members, issues books, accepts returns, and sees fines and overdue books.
- A member logs in, searches the catalogue, and sees the books they hold, their due dates, and any fine.
- The system itself works out due dates (14 days after issue) and fines (Rs. 10 for each day late).
Who uses it
| User | What they can do |
|---|---|
| Admin (librarian) | Everything: books, members, issue, return, dashboard, history |
| Member | Search books, view the books they hold and their history |
Scope — what is in, and what is not
In scope: login with two roles, book catalogue and search, member management, issue and return, due dates, fine calculation, dashboard, overdue list, full issue history.
Out of scope (the official E-Library specification mentions reservations, but they are not built here): book reservations, email reminders, a member "change password" page, and printed fine receipts. These are listed as future improvements at the end of this guide. Saying clearly what you did NOT build — and why — is something viva examiners respect.
2. What you will learn (read this before you start coding)
You do not need to know everything below in advance. Learn each item when you reach the module that uses it.
| Topic | Where you use it |
|---|---|
| HTML forms (GET vs POST) | Every page: login, add book, issue, return |
| PHP basics: variables, if/else, loops, functions | Every file |
PHP sessions ($_SESSION) |
Login: remembering who is logged in |
| MySQL: tables, primary keys, foreign keys | schema.sql |
PDO prepared statements (? placeholders) |
Every database query — this is how SQL injection is stopped |
password_hash() / password_verify() |
Login and member registration |
SQL transactions (beginTransaction / commit / rollBack) |
Issue and return — two changes that must happen together |
| SQL joins (books + members + issues) | Dashboard, issue history, My Books |
DATE functions (CURDATE(), DATEDIFF()) |
Due dates, overdue list, fine calculation |
Suggested order of work (about 4–6 weeks for one student)
- Week 1: install XAMPP, create the database, write the SRS (Section 3).
- Week 2: design the database and draw the ERD (Section 4).
- Weeks 3–4: write the code module by module (Section 5).
- Week 5: run the test cases (Section 6) and fix the bugs they find.
- Week 6: prepare the final report and practise the viva questions (Section 7).
3. SRS — Software Requirements Specification
This section is written so you can copy it into your SRS document (with your own project details) — it follows the sections VU expects in an SRS: purpose, scope, actors, functional requirements, non-functional requirements, and use cases.
3.1 Purpose
To build a web-based Library Management System that automates book issue, return, fine calculation and record keeping for a library, replacing manual registers with a system that is fast, searchable and always up to date.
3.2 Scope
The system covers the daily work of a small library: catalogue management, member registration, issuing and returning books, fines for late returns, and reports (dashboard counts, overdue list, issue history). It does not cover book purchasing, reservations, or email/SMS reminders.
3.3 Actors
- Admin (librarian): manages the whole system. There is one admin account to start with; more admin accounts can be added directly in the database.
- Member: a registered library user. Members borrow books and view their own loans. Members cannot change the catalogue or issue books to other people.
3.4 Functional requirements
| ID | Requirement |
|---|---|
| FR1 | The system shall let a user log in with a username and password. Wrong credentials shall be rejected with one general error message. |
| FR2 | The system shall show different menus for admin and member after login. |
| FR3 | The admin shall add a book with title, author, ISBN, category, publisher, year, number of copies and shelf location. ISBN shall be unique. |
| FR4 | The admin shall edit and delete books. A book with issue history shall not be deletable. |
| FR5 | Any logged-in user shall search books by title, author or ISBN. |
| FR6 | The admin shall register a member with name, username, email, password, phone and address. The system shall generate the membership number (MEM-0001, MEM-0002, ...). |
| FR7 | The admin shall edit a member, including suspending a member. A suspended member shall not be able to borrow books. |
| FR8 | The admin shall issue a book to an active member. The system shall refuse when: no copy is available; the member already holds 3 books; the member already holds this same book. |
| FR9 | On issue, the system shall set the due date to 14 days after the issue date and reduce available copies by 1. |
| FR10 | The admin shall accept a returned book. The system shall set the return date, mark the issue as returned, add 1 back to available copies, and calculate the fine. |
| FR11 | Fine shall be Rs. 10 for each day the book is returned after its due date, and Rs. 0 when returned on time. |
| FR12 | The admin dashboard shall show: total book titles, total copies, total members, books issued now, and overdue books. |
| FR13 | The admin shall see the full issue/return history, filterable by All / Issued / Returned / Overdue. |
| FR14 | A member shall see only their own books: books held now (with days left or fine so far) and books returned (with fine paid). |
3.5 Non-functional requirements
| ID | Requirement |
|---|---|
| NFR1 | Security: passwords shall be stored as hashes, never as plain text. All database queries shall use prepared statements. Pages shall check login on every request. |
| NFR2 | Usability: every action shall show a success or error message. Forms shall keep the typed values when validation fails. |
| NFR3 | Correctness: available copies shall never go below 0 or above total copies (enforced by the database and by the code). |
| NFR4 | Performance: the catalogue search and the dashboard shall answer in under 2 seconds with the sample data. |
| NFR5 | Portability: the system shall run on XAMPP (Apache + MySQL) on Windows without extra software. |
3.6 Use cases
+-----------------------------+
| Library Management System |
| |
Admin ---------->| Login |
| | Manage Books |
| | Manage Members |
| | Issue Book |
| | Return Book |
| | View Dashboard & History |
| |
Member --------->| Login |
| Search Books |
| View My Books |
+-----------------------------+
| Use case | Actor | Main flow |
|---|---|---|
| Login | Admin, Member | Enter username + password → system checks credentials → opens the right home page |
| Add Book | Admin | Fill the book form → system validates → book appears in the catalogue |
| Search Books | Admin, Member | Type a word → system lists matching books by title, author or ISBN |
| Register Member | Admin | Fill the member form → system generates MEM-xxxx and creates the login |
| Issue Book | Admin | Pick a member and a book → system runs the 4 checks → due date set, copy taken |
| Return Book | Admin | Pick an issued book → system calculates the fine → copy back on the shelf |
| View Dashboard | Admin | System shows counts, overdue books and recent issues |
| View My Books | Member | System shows the member's own current and returned books |
4. Design
4.1 Architecture
Member / Admin browser
|
| HTTP (forms, links)
v
Apache web server (XAMPP)
|
| PHP files (this project)
v
MySQL database (library_db)
There is no framework and no JavaScript framework. That is a deliberate choice for a final-year project: every line of code is yours, you can explain all of it in the viva, and nothing is hidden inside a library.
Request flow for every page: config.php (session + database connection)
→ header.php (login check + menu) → page logic → footer.php.
4.2 ERD — Entity Relationship Diagram
users (1) ───< issues (N) >─── (1) books
users (1) ───< issues (N) (issued_by is also a user)
books (N) ───> (1) categories
+----------------+ +----------------+
| users | | books |
| id (PK) | | id (PK) |
| name | | title |
| username | | author |
| email | | isbn (unique) |
| password_hash | | category_id FK |
| role | | publisher |
| membership_no | | published_year |
| phone, address | | total_copies |
| status | | available_ |
+-------+--------+ | copies |
| +-------+--------+
| 1 | 1
| |
* *
+---v------------+ +----v---------+
| issues | | categories |
| id (PK) | | id (PK) |
| book_id (FK) --+ | name |
| member_id (FK)| +--------------+
| issued_by (FK)|
| issue_date |
| due_date |
| return_date |
| status |
| fine_amount |
+---------------+
Relationships (read "1" as "one", "N" as "many"):
| Relationship | Meaning |
|---|---|
users 1 — N issues (member_id) |
One member can borrow many books over time; each issue belongs to one member. |
users 1 — N issues (issued_by) |
One admin can issue many books; each issue records which admin issued it. |
books 1 — N issues (book_id) |
One book title can be issued many times; each issue is for one title. |
categories 1 — N books (category_id) |
One category holds many books; each book has at most one category. |
4.3 Database design, table by table
users — everyone who can log in. role is admin or member.
membership_no is filled only for members (NULL for admins) and is unique.
password_hash holds a bcrypt hash, never the password itself. status
is active or suspended; only the admin can change it.
categories — just id and name (unique). Kept as a table instead of
a text field so the category list is consistent and the "Add Book" form
can offer a dropdown.
books — one row per title, not per physical copy. total_copies
is how many the library owns; available_copies is how many are on the
shelf now. Two rules protect these numbers: a database CHECK
(available_copies between 0 and total_copies) and the code, which
only changes them inside a transaction (Section 5.5). isbn is unique —
the same book cannot be added twice by mistake. category_id is a
foreign key with ON DELETE SET NULL: deleting a category does not
delete its books, it just clears their category.
issues — one row per borrowing. issue_date and due_date are
dates; return_date is NULL while the book is out. status is
issued or returned. fine_amount is 0 until the book comes back,
then it holds the fine charged.
Why "overdue" is NOT a status. A tempting design is a third status,
overdue. The problem: a book becomes overdue at midnight, but nobody
updates the database at midnight — so the stored status would be wrong
until someone runs an update. Instead this system computes overdue:
a book is overdue when status = 'issued' AND due_date < today.
The answer is always correct, with no daily job. This is a good example
to quote in the viva when asked about a design decision.
4.4 UI flow (page map)
index.php (Login)
|
+-- admin --> dashboard.php
| |-- books.php <--> book_add / book_edit / book_delete
| |-- members.php <--> member_add / member_edit / member_delete
| |-- issue.php
| |-- return.php
| +-- issues.php
|
+-- member -> my_books.php
+-- books.php (search, read-only)
4.5 Design decisions worth defending in the viva
- PDO prepared statements everywhere. User input is never pasted into SQL. This stops SQL injection completely.
- Transactions for issue and return. Issuing a book is two changes (new issue row + one fewer available copy). A transaction makes them atomic: both happen or neither does.
FOR UPDATErow lock on issue. If two admins issue the last copy at the same moment, the lock makes them wait in turn; the second one then sees 0 copies and is refused.- Computed overdue status (see 4.3) — no stale data, no daily job.
- No framework. Every line is the student's own code and can be explained in the viva.
5. Coding — module by module
Each module is explained in plain English first, then the important code is shown with line-by-line notes. The full code is in the files beside this guide — read the module, then open its file and follow along.
5.1 Module 1 — Configuration and database connection (config.php)
What it does: every page needs two things — a session (to remember
who is logged in) and a database connection. config.php provides both,
plus small helper functions, so no page repeats that setup.
session_start(); // (1)
define('DB_HOST', 'localhost'); // (2)
define('DB_NAME', 'library_db');
define('DB_USER', 'root');
define('DB_PASS', ''); // XAMPP default: root has no password
define('LOAN_DAYS', 14); // (3)
define('FINE_PER_DAY', 10);
define('MAX_BOOKS_PER_MEMBER', 3);
$pdo = new PDO( // (4)
'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4',
DB_USER, DB_PASS,
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]
);
Line by line: (1) session_start() must run before any HTML is printed,
or PHP shows a "headers already sent" error. (2) The database settings
are constants, so they are written once and used everywhere. (3) The
library rules (14 days, Rs. 10, 3 books) are also constants — changing a
rule means changing one line, not searching every file. (4) PDO is PHP's
database layer. ERRMODE_EXCEPTION means a database error throws an
exception instead of failing silently. FETCH_ASSOC means rows come back
as ['title' => '...', 'author' => '...'] arrays.
Helpers in the same file: e() escapes text before printing it
(stops cross-site scripting); redirect() sends the browser elsewhere;
flash() / showFlash() carry a one-time message to the next page;
requireLogin() and requireAdmin() guard pages.
5.2 Module 2 — Login and sessions (index.php, logout.php)
What it does: checks a username and password, then remembers the user in the session until logout.
$stmt = $pdo->prepare('SELECT * FROM users WHERE username = ?');
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && $user['status'] === 'active'
&& password_verify($password, $user['password_hash'])) {
session_regenerate_id(true);
$_SESSION['user_id'] = (int) $user['id'];
$_SESSION['role'] = $user['role'];
// ... then redirect to dashboard (admin) or My Books (member)
}
Line by line: the ? in the query is a placeholder — the username is
sent separately, so even a username like ' OR '1'='1 cannot change the
SQL (this is the SQL-injection defence). password_verify() compares
the typed password with the stored hash; the real password is never in
the database. session_regenerate_id(true) gives the user a fresh
session id after login, so an old session id cannot be reused.
$_SESSION is a server-side array that survives from page to page —
that is how the system "remembers" the login. The error message is
always the same ("Invalid username or password") whether the username
or the password was wrong, so an attacker cannot learn which usernames
exist.
5.3 Module 3 — Book catalogue (books.php, book_add.php, book_edit.php, book_delete.php)
What it does: list and search books; add, edit and delete them (admin only).
Search (from books.php):
$stmt = $pdo->prepare(
'SELECT b.*, c.name AS category_name
FROM books b
LEFT JOIN categories c ON c.id = b.category_id
WHERE b.title LIKE ? OR b.author LIKE ? OR b.isbn LIKE ?
ORDER BY b.title ASC'
);
$like = '%' . $search . '%';
$stmt->execute([$like, $like, $like]);
LEFT JOIN brings in the category name; a book with no category still
appears (its category shows as "—"). LIKE '%word%' matches the word
anywhere in the title, author or ISBN. The same search text is bound
three times, once per ?.
Edit — the copy-count problem (from book_edit.php): if 2 of 3 copies
are out on loan, the admin must not be allowed to reduce the total to 1.
The code computes issued = total_copies - available_copies, refuses a
new total below issued, and sets available = new_total - issued.
This is the one place where the arithmetic matters — test it (TC-12).
Delete (from book_delete.php): two rules. First, deletion needs a
confirmation page with a POST form, so a plain link can never delete
anything. Second, a book with any issue history cannot be deleted,
because the history table references it.
5.4 Module 4 — Members (members.php, member_add.php, member_edit.php, member_delete.php)
What it does: register and manage members. A member is a users
row with role = 'member'.
The membership number is generated, not typed (from member_add.php):
$maxNo = (int) $pdo->query(
"SELECT COALESCE(MAX(CAST(SUBSTRING(membership_no, 5) AS UNSIGNED)), 0)
FROM users WHERE membership_no LIKE 'MEM-%'"
)->fetchColumn();
$membershipNo = 'MEM-' . str_pad((string) ($maxNo + 1), 4, '0', STR_PAD_LEFT);
It reads the highest existing number (MEM-0003 → 3), adds 1, and pads
it to 4 digits (MEM-0004). COALESCE(..., 0) handles the first member
ever, when no number exists yet. The password is stored with
password_hash($password, PASSWORD_DEFAULT).
The members list also shows "books out" per member, with a subquery that counts that member's currently issued books — the same count the issue page uses for the 3-book limit.
5.5 Module 5 — Issue a book (issue.php) — the most important module
What it does: lends a book to a member, after four checks, inside a transaction.
$pdo->beginTransaction(); // (1)
$stmt = $pdo->prepare('SELECT * FROM books WHERE id = ? FOR UPDATE');
$stmt->execute([$bookId]); // (2)
$book = $stmt->fetch();
if ((int) $book['available_copies'] <= 0) {
throw new Exception('No copies of this book are available right now.');
}
// ... member check, 3-book limit check, same-book check ...
$issueDate = date('Y-m-d'); // (3)
$dueDate = date('Y-m-d', strtotime('+' . LOAN_DAYS . ' days'));
$stmt = $pdo->prepare(
'INSERT INTO issues (book_id, member_id, issued_by, issue_date, due_date)
VALUES (?, ?, ?, ?, ?)'
);
$stmt->execute([$bookId, $memberId, $_SESSION['user_id'], $issueDate, $dueDate]);
$stmt = $pdo->prepare(
'UPDATE books SET available_copies = available_copies - 1 WHERE id = ?'
);
$stmt->execute([$bookId]);
$pdo->commit(); // (4)
Line by line: (1) beginTransaction() starts the transaction — from
here, nothing is saved until commit(). (2) FOR UPDATE locks the
book row: if another admin is issuing the same book at the same moment,
they wait until this transaction finishes, then see the updated copy
count. (3) The due date is today + 14 days, computed by PHP so the
database never has to know the loan rule. (4) commit() saves both
changes together. If any check throws an exception, the catch block
calls rollBack() and nothing is saved — the database can never hold
an issue without a copy taken, or a copy taken without an issue.
The four checks (each with its own message): member is active; a copy is available; the member holds fewer than 3 books; the member does not already hold this same book.
5.6 Module 6 — Return a book and calculate the fine (return.php)
What it does: takes a book back and works out the fine.
$dueDate = new DateTime($issue['due_date']);
$today = new DateTime('today');
$daysLate = ($today > $dueDate) ? (int) $today->diff($dueDate)->days : 0;
$fine = $daysLate * FINE_PER_DAY;
DateTime::diff()->days gives whole days between two dates. If today
is on or before the due date, $daysLate is 0 and the fine is Rs. 0.
Example: due 1 November, returned 5 November → 4 days late → Rs. 40.
The update runs in a transaction, like issue: set return_date to
today, status to returned, fine_amount to the fine — and add 1
back to available_copies.
5.7 Module 7 — Dashboard and history (dashboard.php, issues.php, my_books.php)
What it does: turns the stored rows into answers.
- Dashboard counts are single
COUNT(*)queries — cheap and fast. - The overdue list is
WHERE status = 'issued' AND due_date < CURDATE()withDATEDIFF(CURDATE(), due_date)for the days late. issues.phpfilters with aWHEREclause built from thefilterparameter — but only after checking it against an allowed list (all,issued,returned,overdue), so a made-up filter value can never reach the SQL.my_books.phptakes the member id from the session, never from the URL — so a member cannot view another member's books by changing an address.
6. Testing — test cases to run before submission
Run every case below against the working system and record Pass/Fail. A failed case is not a disaster — it is what testing is for; fix the bug, then run the case again.
| ID | Test | Steps | Expected result |
|---|---|---|---|
| TC-1 | Login (admin) | Log in as admin / admin123 | Dashboard opens, admin menu shown |
| TC-2 | Login (member) | Log in as ahmed / member123 | My Books opens, member menu shown (no Dashboard link) |
| TC-3 | Wrong password | Log in as admin with a wrong password | "Invalid username or password", still on login page |
| TC-4 | Page guard | Open dashboard.php without logging in | Sent back to the login page |
| TC-5 | Member guard | As a member, open members.php directly | Sent back to the dashboard with an error |
| TC-6 | Add book | Add a book with 2 copies | Book appears in the list with "2 / 2" |
| TC-7 | Duplicate ISBN | Add the same ISBN again | "A book with this ISBN already exists" |
| TC-8 | Search | Search "Cormen" | Only the Algorithms book is listed |
| TC-9 | Add member | Register a new member | Membership number is generated (next in sequence) |
| TC-10 | Issue book | Issue "Clean Code" to Ahmed | Due date is today + 14 days; available copies drop by 1 |
| TC-11 | Issue 4th book | Give a member 3 books, then issue a 4th | Refused: "already holds 3 books" |
| TC-12 | Same book twice | Issue the same book to the same member twice | Second issue refused |
| TC-13 | Issue out-of-stock | Issue the last copy, then issue it again to someone else | Second issue refused: "No copies available" |
| TC-14 | Suspended member | Suspend a member, then issue them a book | Refused: member is suspended |
| TC-15 | Return on time | Return a book before its due date | "Returned on time. No fine." Fine Rs. 0 |
| TC-16 | Return late | Change a due date to 4 days ago in the database, then return it | Fine Rs. 40 (4 x Rs. 10) |
| TC-17 | Double return | Return the same issue twice | Second attempt: "already returned" |
| TC-18 | Delete with history | Delete a book that was once issued | Refused: book has issue history |
| TC-19 | Delete clean book | Delete a book that was never issued | Book disappears from the list |
| TC-20 | My Books privacy | As Ahmed, check My Books | Only Ahmed's books appear, never Sara's |
How to make a book overdue for TC-16: in phpMyAdmin, open the issues
table, find the issue row, and set its due_date to 4 days ago. Then
return the book on the Return page.
7. Viva Q&A — questions the examiner is likely to ask
Q1. What does your project do? It automates a library: the admin manages books and members, issues and returns books, and the system calculates due dates and fines. Members log in to search books and see their own loans.
Q2. Which technologies did you use, and why? PHP and MySQL on XAMPP — the stack in the official project specification. No framework, so all the code is mine and I can explain every line.
Q3. Show me your database design. Why four tables?
users (login + members), categories, books (one row per title),
issues (one row per borrowing). Four tables is enough because a member
is a user with a role, and a borrowing is the only thing that connects a
member to a book. The ERD is in Section 4.2.
Q4. What is a foreign key? Give an example from your project.
A column that must match a primary key in another table. issues.book_id
must be an id from books — the database refuses an issue for a book
that does not exist.
Q5. How do you stop SQL injection?
Every query uses PDO prepared statements with ? placeholders. User
input is sent as data, never pasted into the SQL string, so input like
' OR '1'='1 is treated as a plain value, not as SQL.
Q6. How are passwords stored?
With password_hash(), which makes a bcrypt hash. The plain password is
never stored. Login checks with password_verify().
Q7. How is the fine calculated?
Due date is issue date + 14 days. On return, days late = today − due
date (0 if on time). Fine = days late × Rs. 10. See return.php.
Q8. Why is there no "overdue" status in the database?
Because it would go stale: a book becomes overdue at midnight, but
nothing updates the row at midnight. Instead overdue is computed —
status = 'issued' and due_date < today — so it is always correct.
Q9. What is a transaction, and where did you use one? A group of database changes that succeed together or fail together. Issuing a book is two changes (new issue row + one fewer copy), so they run in one transaction; if the second failed, the first would be rolled back and the data would stay consistent.
Q10. Two admins issue the last copy at the same moment. What happens?
The first transaction locks the book row with FOR UPDATE. The second
waits, then sees 0 available copies and is refused. Without the lock,
both could succeed and available copies would go to −1.
Q11. How does the system know who is logged in on each page?
PHP sessions. After login, the user id, name and role are stored in
$_SESSION. Every page includes config.php (which starts the session)
and header.php (which calls requireLogin()).
Q12. What is the difference between the admin and the member? The admin manages books, members, issues and returns and sees the dashboard and full history. The member only searches books and views their own loans. The menu and the page guards enforce this.
Q13. What would you add if you had more time?
Book reservations, email reminders for overdue books, a member
"change password" page, and a printable fine receipt. Reservations
would need a reservations table and a Reserve button on the book list.
Q14. What was the hardest bug you fixed? (The student should answer from their own testing — for example the copy-count arithmetic when editing a book's total copies, or a transaction rolling back during testing. Do not memorise an answer to this one; it must be true.)
8. Deliverables checklist (what to submit)
- [ ] SRS document (Section 3 of this guide, written as your own document)
- [ ] Design document (ERD, architecture, UI flow — Section 4)
- [ ] Source code (all files in this folder, working)
- [ ] Database file (
schema.sql) - [ ] Test report (the test cases in Section 6, with Pass/Fail filled in)
- [ ] Final report (what you built, how, and what you learned)
- [ ] Presentation slides for the final viva
- [ ] Demo video or live demo (run the system on your own laptop)
9. Common errors and fixes
| Error / symptom | Cause | Fix |
|---|---|---|
| "Database connection failed" | MySQL is not running, or schema.sql was not imported |
Start MySQL in XAMPP; import schema.sql in phpMyAdmin |
| "Table 'library_db.users' doesn't exist" | The schema was imported into the wrong database, or not at all | Re-import schema.sql (it creates the database itself) |
| "headers already sent" | Something printed output before session_start() or header() |
Check for blank lines or spaces before <?php in the file; config.php must be included first |
| Login always fails | The sample users were not imported, or the hash was changed | Re-import schema.sql; check the user exists in phpMyAdmin |
| Available copies go below 0 | Issuing without the availability check, or without the transaction | Use issue.php as written; never update copies by hand in phpMyAdmin |
| "A book with this ISBN already exists" | ISBN is unique in the database | This is correct behaviour — use a different ISBN for a different edition |
| Apache will not start | Port 80 is already in use | Stop the other program, or change Apache's port in the XAMPP control panel |
| Page shows nothing (white screen) | A PHP error is hidden by the server settings | Temporarily add error_reporting(E_ALL); ini_set('display_errors', '1'); at the top of config.php to see the message, then remove it |
10. Future improvements
- Book reservations — a
reservationstable (member, book, date) and a Reserve button; when a copy returns, the first reserver is notified. - Email reminders — a daily script that emails members whose books are due tomorrow or overdue.
- Change password page — let members change their own password after first login instead of the admin setting it.
- Fine receipt — a printable receipt page when a fine is paid.
- Pagination — split the book list into pages when the catalogue grows past a few dozen titles.
Frequently Asked Questions
- Which stack does this Library Management System use? PHP and MySQL on XAMPP, as stated in the official VU specifications. The demo accounts are admin/admin123 and ahmed/member123.
- Does the code really work? Yes. It was runtime-verified: all 18 PHP files pass
php -l, the schema imports cleanly into MySQL, the admin and member logins work, and issuing a book sets the 14-day due date and reduces the available copies. - Can I use this project for my CS619 final year project? Yes — it follows VU's own phases (SRS, design, coding, testing, viva). Change the sample data, add your own features from the future-improvements list, and write the SRS in your own words before submitting.
Comments
Post a Comment