Experiment 10 Dbms
Experiment 10 Dbms
i. Create the database design with required tables (using SQL) as:
iii. Value of fine for books returned late should be as per any chosen criteria.
iv. Basic project should contain required design forms with features to support step ii and iii
respectively.
Brief Description:
The document details "Experiment No: 9," involving the design and implementation of a
Library Information System. It outlines the objective, hardware and software requirements,
and steps for achieving the objective, relevant for database design and system implementation
projects in educational settings.
Implementation:-
Create db.php
<?php
$servername = "localhost"; // Your server name
$username = "root"; // Your database username
$password = "saptarshi@11"; // Your database password (leave empty if not set)
$dbname = "library"; // Your database name
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
Create insert_student_details.php
<?php
include 'db.php'; // Include the database connection
Create insert_book_details.php
<?php
include 'db.php'; // Include the database connection
// Insert sample data into Book_Details
$sql = "INSERT INTO Book_Details (Account_No, author, title, publication, volume,
edition, copies, price, status) VALUES
('B001', 'J.K. Rowling', 'Harry Potter and the Chamber of Secrets', 'Scholastic', '1', '1st', 10,
19.99, 'Available'),
('B002', 'George Orwell', 'Animal Farm', 'Secker & Warburg', '1', '1st', 8, 14.99, 'Available'),
('B003', 'J.R.R. Tolkien', 'The Fellowship of the Ring', 'George Allen & Unwin', '1', '2nd', 5,
15.50, 'Available'),
('B004', 'F. Scott Fitzgerald', 'The Great Gatsby', 'Charles Scribner\'s Sons', '1', '1st', 7, 10.99,
'Available'),
('B005', 'Harper Lee', 'To Kill a Mockingbird', 'J.B. Lippincott & Co.', '1', '1st', 6, 12.99,
'Available')";
Create insert_book_issue.php
<?php
include 'db.php'; // Include the database connection
Create insert_book_return.php
<?php
include 'db.php'; // Include the database connection
Create fine-calc.php
<?php
include 'db.php'; // Include the database connection
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<h2>Overdue Books and Fines</h2>";
echo "<table border='1'>
<tr>
<th>Enrollment No</th>
<th>Overdue Days</th>
<th>Total Fine</th>
</tr>";
while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>" . htmlspecialchars($row["enrollment_no"]) . "</td>
<td>" . htmlspecialchars($row["overdue_days"]) . "</td>
<td>" . htmlspecialchars($row["total_fine"]) . "</td>
</tr>";
}
echo "</table>";
} else {
echo "No overdue books found.";
}