diff --git a/index.php b/index.php index 91f38ff..ea3b05b 100644 --- a/index.php +++ b/index.php @@ -3,18 +3,21 @@ include 'vendor/autoload.php'; set_time_limit(-1); - - $db = new SQLite3('data.db'); if (isset($_GET['category']) && strlen($_GET['category'])) { $stmt = $db->prepare('SELECT * FROM book WHERE category_slug = :category_slug'); $stmt->bindValue(':category_slug', $_GET['category'], SQLITE3_TEXT); +} elseif (isset($_POST['search']) && isset($_POST['title']) && !empty($_POST['title'])) { + $stmt = $db->prepare('SELECT * FROM book WHERE title like :search'); + $stmt->bindValue(':search', '%' . $_POST['title'] . '%', SQLITE3_TEXT); } else { $stmt = $db->prepare('SELECT * FROM book '); } -//$stmt->bindValue(':nid', $bookData['nid'], SQLITE3_INTEGER); $result = $stmt->execute(); +echo "
Clear
"; + + echo ''; print(''); while ($resultArray = $result->fetchArray(SQLITE3_ASSOC)) { diff --git a/packt.php b/packt.php index 24ec5ff..7db6e55 100644 --- a/packt.php +++ b/packt.php @@ -107,7 +107,7 @@ $books = $document->find('.product-line.unseen'); $dl = 0; $db = new SQLite3('data.db'); -shuffle($books); +//shuffle($books); foreach ($books as $book) { $bookData = [];
idnidTitleCategoryPublish datePagesVotesRating Pdf Epub Mobi Code