Added keyword searching.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Get and use a basic title search for pulling records.
|
||||
$titlesearch = htmlspecialchars($_GET["titlesearch"]);
|
||||
$keywordsearch = htmlspecialchars($_GET["kw"]);
|
||||
|
||||
// -------------------- BEGIN DATABASE QUERIES --------------------
|
||||
|
||||
@ -9,13 +9,20 @@ $titlesearch = htmlspecialchars($_GET["titlesearch"]);
|
||||
$db = new SQLite3('metadata.sqlite');
|
||||
|
||||
$titlequery = $db->query("SELECT
|
||||
books.id AS id,
|
||||
DISTINCT books.id AS id,
|
||||
books.title AS title,
|
||||
SUBSTR(comments.text,0,120) AS excerpt
|
||||
FROM books
|
||||
INNER JOIN
|
||||
comments ON comments.book = books.id
|
||||
WHERE books.title LIKE '%$titlesearch%'
|
||||
INNER JOIN
|
||||
books_tags_link ON books_tags_link.book = books.id
|
||||
INNER JOIN
|
||||
tags ON tags.id = books_tags_link.tag
|
||||
WHERE books.title LIKE '%$keywordsearch%'
|
||||
OR books.author_sort LIKE '%$keywordsearch%'
|
||||
OR comments.text LIKE '%$keywordsearch%'
|
||||
OR tags.name LIKE '%$keywordsearch%'
|
||||
ORDER BY books.title ASC");
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user