this is my first post here so take easy on me.
I need help in selecting a certain part of the sentence while looking to display a sugestion to the user.
It's an ajax based search suggest that anytime somebody start typing a word it drops down a list with 15 result starting with the letters typed in.
It works perfect because overtime I stored some searches previous customers did so I am looking into that table at the moment, but I have another table (products) with over 10.000 records that I would like to use instead getting better results.
The problem I have is that the query string looks into the product name field from the begining and if found it displays it but I would like to look inside and start from where it found a match.
eg.
Product Name = I am a developer with a lot of things in my mind
The user start typing "developer" so I would like the query to the database to pick that and only show in the suggestion list "developer with"
The query I am using at the moment is:
Code: Select all
"SELECT search_query,search_results FROM ".$oData->requesting." WHERE search_query like '".
$oData->text."%' and search_results > 0 order by search_results DESC limit 0,".$oData->limit;