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 "
"; + + echo '| id | nid | Title | Category | Publish date | Pages | Votes | Rating | Epub | Mobi | Code |
|---|