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

A place to make for-pay "CMS made simple" job offerings
Post Reply
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

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

Post 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>';

Last edited by applejack on Mon Jan 18, 2010 8:06 pm, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Ajax Search Help Required

Post by Jeff »

It is because the search database has the pages saved one word at a time.
Post Reply

Return to “Help Wanted (commercial)”