From 1199fd1dd506350d783e24bcece54961919e75fa Mon Sep 17 00:00:00 2001 From: Edwin Smulders Date: Mon, 23 Jul 2007 21:00:37 +0000 Subject: [PATCH] Make searches use words as keywords --- include/util.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/util.php b/include/util.php index b896f30..ee6c425 100644 --- a/include/util.php +++ b/include/util.php @@ -466,15 +466,17 @@ function searchForApplication($search_words) } } + $search_words = str_replace(' ', '%', mysql_real_escape_string($search_words)); + /* base query */ $sQuery = "SELECT * FROM appFamily, vendor WHERE appName != 'NONAME' AND appFamily.vendorId = vendor.vendorId AND appFamily.queued = 'false' - AND (appName LIKE '%".mysql_real_escape_string($search_words)."%' - OR keywords LIKE '%".mysql_real_escape_string($search_words)."%'"; - + AND (appName LIKE '%" . $search_words . "%' + OR keywords LIKE '%" . $search_words . "%'"; + /* append to the query any vendors that we matched with */ foreach($vendorIdArray as $key=>$value) {