From 1e590fe9497195fd6daeee2871b73819f31ed055 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Thu, 5 Aug 2021 10:28:31 -0400 Subject: [PATCH] Quick fix --- api/tags_autocomplete.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/tags_autocomplete.php b/api/tags_autocomplete.php index cc32c31..d07cb2f 100644 --- a/api/tags_autocomplete.php +++ b/api/tags_autocomplete.php @@ -13,6 +13,9 @@ if (empty($_GET['tag'])) { $tag_name = Tag::cleanTagName($_GET['tag']); $tag_name = str_replace('%', '', $tag_name); /* get rid of MySQL LIKE wildcards */ -$results = $conn->query('SELECT name FROM tags WHERE name LIKE ?', [$tag_name . '%']); +$results = $conn->query('SELECT name FROM tags WHERE name LIKE ? AND name != ?', [$tag_name . '%', $tag_name]); +$tags = $results->fetchAll(); -echo json_encode($results->fetchAll()); +array_push($tags, ['name' => $tag_name]); + +echo json_encode($tags);