From 835d3bfc79f6417a4a468491ffcd5a3ebd7e35f4 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 30 Mar 2011 01:41:59 +1100 Subject: [PATCH] fully replace SQL wildcard with * --- mod.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod.php b/mod.php index af213fd4..a9901ff7 100644 --- a/mod.php +++ b/mod.php @@ -317,7 +317,7 @@ $_body = ''; // Remove SQL wildcard - $phrase = str_replace('%', '%%', $phrase); + $phrase = str_replace('%', '!%', $phrase); // Use asterisk as wildcard to suit convention $phrase = str_replace('*', '%', $phrase); @@ -345,7 +345,7 @@ if(!empty($like)) $like .= ' AND '; $phrase = preg_replace('/^\'(.+)\'$/', '\'%$1%\'', $phrase); - $like .= '`body` LIKE ' . $phrase; + $like .= '`body` LIKE ' . $phrase . ' ESCAPE \'!\''; } $like = str_replace('%', '%%', $like);