Results page: Type.
This commit is contained in:
39
results.php
39
results.php
@ -5,22 +5,27 @@ include_once "settings.php";
|
||||
// Get and use a basic title search for pulling records.
|
||||
$keywordsearch = htmlspecialchars($_GET["kw"]);
|
||||
$authorsearch = htmlspecialchars($_GET["au"]);
|
||||
$typesearch = htmlspecialchars($_GET["ty"]);
|
||||
|
||||
$socialkw = mb_convert_case($keywordsearch, MB_CASE_TITLE, "UTF-8");
|
||||
$socialau = mb_convert_case($authorsearch, MB_CASE_TITLE, "UTF-8");
|
||||
$socialty = mb_convert_case($typesearch, MB_CASE_TITLE, "UTF-8");
|
||||
|
||||
if (empty($keywordsearch)) {
|
||||
if (!empty($keywordsearch)) {
|
||||
$searchtopic = $socialkw;
|
||||
} elseif (!empty($authorsearch)) {
|
||||
$searchtopic = $socialau;
|
||||
} else {
|
||||
$searchtopic = $socialkw;
|
||||
$searchtopic = 'Type: '.$socialty;
|
||||
}
|
||||
|
||||
|
||||
// -------------------- BEGIN DATABASE QUERIES --------------------
|
||||
|
||||
// Establish atabase connection
|
||||
$db = new SQLite3('metadata.sqlite');
|
||||
|
||||
$titlequery = $db->query("SELECT
|
||||
$keywordquery = $db->query("SELECT
|
||||
DISTINCT books.id AS id,
|
||||
books.title AS title,
|
||||
SUBSTR(comments.text,0,120) AS excerpt
|
||||
@ -46,11 +51,23 @@ INNER JOIN
|
||||
comments ON comments.book = books.id
|
||||
INNER JOIN
|
||||
books_tags_link ON books_tags_link.book = books.id
|
||||
INNER JOIN
|
||||
tags ON tags.id = books_tags_link.tag
|
||||
WHERE books.author_sort LIKE '%$authorsearch%'
|
||||
ORDER BY books.title ASC");
|
||||
|
||||
$typequery = $db->query("SELECT
|
||||
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
|
||||
INNER JOIN
|
||||
books_custom_column_1_link ON books_custom_column_1_link.book = books.id
|
||||
INNER JOIN
|
||||
custom_column_1 ON custom_column_1.id = books_custom_column_1_link.value
|
||||
WHERE
|
||||
custom_column_1.value = '$typesearch'
|
||||
ORDER BY books.title ASC");
|
||||
?>
|
||||
|
||||
|
||||
@ -189,7 +206,7 @@ ORDER BY books.title ASC");
|
||||
<li><a href="#"><i class="icon-instagram"></i></a></li>
|
||||
</ul> -->
|
||||
<div class="col-lg-12 col-md-12 text-center">
|
||||
<h1 id="fh5co-logo"><a href="index.html">Search Results: <?php echo $searchtopic; ?></a></h1>
|
||||
<h1 id="fh5co-logo"><a href="index.php">Search Results - <?php echo $searchtopic; ?></a></h1>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -206,7 +223,15 @@ ORDER BY books.title ASC");
|
||||
<div class="col-md-12 animate-box">
|
||||
<?php
|
||||
if ($keywordsearch != '') {
|
||||
while ($row = $titlequery->fetchArray()) {
|
||||
while ($row = $keywordquery->fetchArray()) {
|
||||
$row_id = $row['id'];
|
||||
$row_title = $row['title'];
|
||||
$row_excerpt = $row['excerpt'];
|
||||
|
||||
echo '<p style="padding:25px 0 35px 0;"><img style="float:left; max-height: 120px; padding: 10px 10px" src="images/'.$row_id.'.jpg"><strong><em><a href="itemrecord.php?itemid='.$row_id.'">'.$row_title.'</em></a> :</strong> '.strip_tags($row_excerpt).'...</p>';
|
||||
}
|
||||
} elseif ($typesearch != '') {
|
||||
while ($row = $typequery->fetchArray()) {
|
||||
$row_id = $row['id'];
|
||||
$row_title = $row['title'];
|
||||
$row_excerpt = $row['excerpt'];
|
||||
|
Reference in New Issue
Block a user