wiki:ImportantCase3

Version 9 (modified by 222039, 4 days ago) ( diff )

--

Детален приказ на книга

Актери

  • Најавен корисник

Чекор 1

Корисникот ја избира книгата за која сака да види подетални информации

Чекор 2

Детален приказ на книгата

 $sql = "SELECT book.*, book_details.*, firstname, lastname, author_description, author_image FROM book
            INNER JOIN book_author ON book.bookid =  book_author.bookid
            INNER JOIN author ON book_author.authorid = author.authorid
            INNER JOIN book_details ON book.bookid = book_details.bookid
            WHERE book.bookid = :bookid;
            ";
    $stmt = $conn->prepare($sql);
    $stmt->bindParam(':bookid', $param, PDO::PARAM_INT);

    $sql2 = "SELECT 
                b.BookID, 
                b.TotalCopies - COALESCE(COUNT(l.LoanID), 0) AS AvailableCopies
                FROM Book b
                LEFT JOIN Loan l 
                ON l.BookCopyID IN (SELECT CopyID FROM Book_Copies WHERE BookID = b.BookID)
                AND l.Status IN ('On Time', 'Soon', 'Overdue')
                WHERE 
                    b.BookID = :bookid
                GROUP BY 
                    b.BookID, b.TotalCopies;";

Чекор 3

Повеќе книги

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.