diff --git a/components/library.php b/components/library.php index b5b92a12a3554905e240f4ab4083728539f6694b..258596aae31bae8e14381abdb001544bd97f24c7 100644 --- a/components/library.php +++ b/components/library.php @@ -35,8 +35,14 @@ if (isset($_REQUEST['search']) && (trim($_REQUEST['search']) != "")) { if (isset($pathlist[$library_index + 2])) { $tag = $pathlist[$library_index + 2]; // we're displaying books with a specific tag - $categories = $DB->GetOne("SELECT count(name) FROM bookcategories WHERE name=?", array($tag)); - if ($categories['count'] == 1) { + //The following line doesn't do what I think you think it does. + //It will return a string if the tag exists, "1" and "0" when a tag doesn't exist + $categories = $DB->GetOne("SELECT count(name) FROM bookcategories WHERE name=?", array($tag)); + //debug stuff, LOOK IT'S A STRING + //var_dump($categories); + //if ($categories['count'] == 1) { + //$categories is not an aray, it's a string, yeah i know == != good_programing + if ($categories == 1) { $mode = "tagdisplay"; $query = "SELECT b.id, b.title FROM books AS b JOIN booktags AS bt ON b.id= bt.bookid"; $query .= " JOIN bookcategories AS bc ON bc.id = bt.tag WHERE bc.name=?";