Page 1 of 1

[NOT SOLVED, BUT NO LONGER REQUIRED] Ajax Search Help Required

Posted: Thu Jan 14, 2010 5:21 pm
by applejack
I am using the ajax_search_suggestions plugin which works fine but it only suggests single words if you try and search on more then one word it doesn't show any suggestions. I have been trying to change the SQL SELECT statement to allow for multiple words. I suspect it is the way it is not handing whitespace. The code is below.

Code: Select all


$params['searchinput'] = $_POST['searchinput'];
$word = htmlspecialchars(trim($params['searchinput']));
$sql = 'SELECT DISTINCT * FROM '.cms_db_prefix().'module_search_index WHERE word LIKE ? LIMIT 20';
$result =& $db->Execute($sql,array($word."%"));
echo '<ul>';
while($result && $row = $result->FetchRow()) {
	echo '<li>'.$row['word'].'</li>';
}
echo '</ul>';


Re: Ajax Search Help Required

Posted: Thu Jan 14, 2010 5:27 pm
by Jeff
It is because the search database has the pages saved one word at a time.