fetchArray()) {
- $row_id = $row['id'];
- $row_title = $row['title'];
- $row_excerpt = $row['excerpt'];
-
- echo '
'.$row_title.' : '.strip_tags($row_excerpt).'...
';
+ if ($results) {
+ $hasResults = false;
+ while ($row = $results->fetchArray(SQLITE3_ASSOC)) {
+ $hasResults = true;
+ $row_id = (int)$row['id'];
+ $row_title = htmlspecialchars($row['title'], ENT_QUOTES, 'UTF-8');
+ $row_excerpt = htmlspecialchars(strip_tags($row['excerpt']), ENT_QUOTES, 'UTF-8');
+
+ echo '
';
+ echo '
';
+ echo '' . $row_title . ' : ';
+ echo $row_excerpt . '...
';
+ }
+
+ if (!$hasResults) {
+ echo '
No results found for your search.
';
+ }
+ } else {
+ echo '
An error occurred while searching. Please try again.
';
}
- } elseif ($typesearch != '') {
- while ($row = $typequery->fetchArray()) {
- $row_id = $row['id'];
- $row_title = $row['title'];
- $row_excerpt = $row['excerpt'];
-
- echo '
'.$row_title.' : '.strip_tags($row_excerpt).'...
';
- }
- } elseif ($authorsearch != '') {
- while ($row = $authorquery->fetchArray()) {
- $row_id = $row['id'];
- $row_title = $row['title'];
- $row_excerpt = $row['excerpt'];
-
- echo '
'.$row_title.' : '.strip_tags($row_excerpt).'...
';
- }
- } elseif ($seriessearch != '') {
- while ($row = $seriesquery->fetchArray()) {
- $row_id = $row['id'];
- $row_title = $row['title'];
- $row_excerpt = $row['excerpt'];
-
- echo '
'.$row_title.' : '.strip_tags($row_excerpt).'...
';
- }
- } elseif ($subjectsearch != '') {
- while ($row = $subjectquery->fetchArray()) {
- $row_id = $row['id'];
- $row_title = $row['title'];
- $row_excerpt = $row['excerpt'];
-
- echo '
'.$row_title.' : '.strip_tags($row_excerpt).'...
';
- }
- } else {
- while ($row = $subtypequery->fetchArray()) {
- $row_id = $row['id'];
- $row_title = $row['title'];
- $row_excerpt = $row['excerpt'];
-
- echo '
'.$row_title.' : '.strip_tags($row_excerpt).'...
';
- }
- }
?>