query($sql) && $conn->query($sql2)) { $result = $conn->query($sql2); $row = $result->fetch_assoc(); $quantity = $row["quantity"]; if($quantity != 0){ $quantity = $quantity - 1; $sql3 = "UPDATE bookrecord SET quantity = '$quantity' WHERE bookId = '$bookId'"; $sql1 = "INSERT INTO borrower (studUsername, bookId, issueDate, returnDate) values('$studUsername', '$bookId', '$issueDate', '$returnDate');"; if($conn->query($sql1) && $conn->query($sql3)){ echo "

Data Successfully Inserted

"; } else { echo "Error: ". $sql1 ."
". $conn->error; } } else{ echo "

Book not available

"; } } else { echo "Error: ". $sql ."
". $conn->error; } $conn->close(); } } else { echo ''; die(); } } } else{ session_destroy(); $_SESSION = array(); header("location: main.php"); } ?> Library Managemenr System
Add Books Books Search Book Update Issue Book Book Submission Book List Student Record Logout

Issue Book


Student Username :
BookId :
Issue Date :
Return Date :