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 "