10 | | SELECT book.bookid, book.CoverImage, book.Title, book.Genre, book.PublishedYear, author.FirstName, author.LastName |
11 | | FROM Book |
12 | | INNER JOIN Book_Author ON Book.BookID = Book_Author.BookID |
13 | | INNER JOIN Author ON Book_Author.AuthorID = Author.AuthorID |
14 | | WHERE book.genre IN ($placeholders) AND book.PublishedYear BETWEEN $query_from AND $query_to;" |
| 10 | $genres_filters = $_GET['genres']; |
| 11 | $placeholders = str_repeat('?,', count($genres_filters) - 1) . '?'; |
| 12 | |
| 13 | $stmt = $conn->prepare("SELECT book.bookid, book.CoverImage, book.Title, book.Genre, book.PublishedYear, author.FirstName, author.LastName |
| 14 | FROM Book |
| 15 | INNER JOIN Book_Author ON Book.BookID = Book_Author.BookID |
| 16 | INNER JOIN Author ON Book_Author.AuthorID = Author.AuthorID |
| 17 | WHERE book.genre IN ($placeholders) AND book.PublishedYear BETWEEN ? AND ?;"); |
| 18 | |
| 19 | $stmt->execute(array_merge($genres_filters, [$query_from, $query_to])); |
48 | | SELECT book.bookid, book.CoverImage, book.Title, book.Genre, book.PublishedYear, author.FirstName, author.LastName |
49 | | FROM Book |
50 | | INNER JOIN Book_Author ON Book.BookID = Book_Author.BookID |
51 | | INNER JOIN Author ON Book_Author.AuthorID = Author.AuthorID WHERE book.PublishedYear BETWEEN $query_from AND $query_to |
| 53 | $stmt = $conn->prepare("SELECT book.bookid, book.CoverImage, book.Title, book.Genre, book.PublishedYear, author.FirstName, author.LastName |
| 54 | FROM Book |
| 55 | INNER JOIN Book_Author ON Book.BookID = Book_Author.BookID |
| 56 | INNER JOIN Author ON Book_Author.AuthorID = Author.AuthorID WHERE book.PublishedYear BETWEEN :year_from AND :year_to; |
| 57 | "); |
| 58 | $stmt->bindParam(":year_from", $query_from, PDO::PARAM_STR); |
| 59 | $stmt->bindParam(":year_to", $query_to, PDO::PARAM_STR); |
| 60 | $stmt->execute(); |