From 351a404067bc2809c8056d1b4229597746bcb7a3 Mon Sep 17 00:00:00 2001 From: Tobias Langhoff Date: Thu, 13 Mar 2014 17:50:21 +0100 Subject: [PATCH] Allow searching for arbitrary tags on documents (not just either one or all tags) --- inside/Documents.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inside/Documents.php b/inside/Documents.php index 05486a3..78b7a4e 100644 --- a/inside/Documents.php +++ b/inside/Documents.php @@ -90,10 +90,11 @@ class Documents { if ($tag == NULL){ return false; } + $tags = implode("%' AND tags LIKE '%", explode(" ", $tag)); $sql = "SELECT d.*, dc.title AS category FROM din_document d, din_documentcategory dc WHERE d.documentcategory_id = dc.id " . - "AND tags LIKE '%$tag%' " . + "AND tags LIKE '%$tags%' " . "ORDER BY name ASC"; $result =& $this->conn->query($sql);