';
echo '
';
echo '' . $row_title . ' : ';
echo $row_excerpt . '...
No results found for your search.
'; } } else { echo 'An error occurred while searching. Please try again.
'; } ?>enableExceptions(true); } catch (Exception $e) { error_log("Database connection error: " . $e->getMessage()); die("Database connection failed"); } // Prepare the appropriate query based on search type $results = null; switch ($searchtype) { case 'keyword': $searchPattern = '%' . $keywordsearch . '%'; $stmt = $db->prepare("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_tags_link ON books_tags_link.book = books.id INNER JOIN tags ON tags.id = books_tags_link.tag WHERE books.title LIKE :search OR books.author_sort LIKE :search OR comments.text LIKE :search OR tags.name LIKE :search ORDER BY books.title ASC LIMIT 100"); $stmt->bindValue(':search', $searchPattern, SQLITE3_TEXT); break; case 'author': $searchPattern = '%' . $authorsearch . '%'; $stmt = $db->prepare("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_tags_link ON books_tags_link.book = books.id WHERE books.author_sort LIKE :search ORDER BY books.title ASC LIMIT 100"); $stmt->bindValue(':search', $searchPattern, SQLITE3_TEXT); break; case 'type': $stmt = $db->prepare("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 = :search ORDER BY books.title ASC LIMIT 100"); $stmt->bindValue(':search', $typesearch, SQLITE3_TEXT); break; case 'subtype': $stmt = $db->prepare("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_3_link ON books_custom_column_3_link.book = books.id INNER JOIN custom_column_3 ON custom_column_3.id = books_custom_column_3_link.value WHERE custom_column_3.value = :search ORDER BY books.title ASC LIMIT 100"); $stmt->bindValue(':search', $subtypesearch, SQLITE3_TEXT); break; case 'series': $stmt = $db->prepare("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_series_link ON books_series_link.book = books.id INNER JOIN series ON series.id = books_series_link.series WHERE series.name = :search ORDER BY books.series_index ASC LIMIT 100"); $stmt->bindValue(':search', $seriessearch, SQLITE3_TEXT); break; case 'subject': $stmt = $db->prepare("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_tags_link ON books_tags_link.book = books.id INNER JOIN tags ON tags.id = books_tags_link.tag WHERE tags.name = :search ORDER BY books.title ASC LIMIT 100"); $stmt->bindValue(':search', $subjectsearch, SQLITE3_TEXT); break; } // Execute query and handle errors try { $results = $stmt->execute(); } catch (Exception $e) { error_log("Query execution error: " . $e->getMessage()); $results = null; } // Get types for menu try { $types = $db->query("SELECT value FROM custom_column_1 ORDER BY value ASC"); } catch (Exception $e) { error_log("Types query error: " . $e->getMessage()); $types = null; } // Build social media URLs safely $socialUrl = ''; switch ($searchtype) { case 'keyword': $socialUrl = $SiteURL . '/results.php?kw=' . urlencode($keywordsearch); break; case 'author': $socialUrl = $SiteURL . '/results.php?au=' . urlencode($authorsearch); break; case 'type': $socialUrl = $SiteURL . '/results.php?ty=' . urlencode($typesearch); break; case 'subtype': $socialUrl = $SiteURL . '/results.php?st=' . urlencode($subtypesearch); break; case 'series': $socialUrl = $SiteURL . '/results.php?se=' . urlencode($seriessearch); break; case 'subject': $socialUrl = $SiteURL . '/results.php?su=' . urlencode($subjectsearch); break; } ?>
A bibliographic management and display system.
A free, open source project from:
The L0WL1F3 Podcast
Neon Dystopia
Cyberpunk Librarian
';
echo '
';
echo '' . $row_title . ' : ';
echo $row_excerpt . '...
No results found for your search.
'; } } else { echo 'An error occurred while searching. Please try again.
'; } ?>