PDA

View Full Version : simple searching script



m@l@y@
10-31-2006, 02:13 PM
hi,

I need a simple way to perform a string search.

e.g.
#
I need to search for "I LOVE PHP"

but when i only type in "I Lov" => it should be able to match the entire string, clean spaces, clean special chars, clean slashes.
#

I only know how to use
preg_match("/$search_string/i", "$word");
but requires that $search should be accurate to the $word

Thanx in Advance.

rlemon
10-31-2006, 02:18 PM
hi,

I need a simple way to perform a string search.

e.g.
#
I need to search for "I LOVE PHP"

but when i only type in "I Lov" => it should be able to match the entire string, clean spaces, clean special chars, clean slashes.
#

I only know how to use
preg_match("/$search_string/i", "$word");
but requires that $search should be accurate to the $word

Thanx in Advance.

little more information required. I.e how are you storing results to search from?
are you querying a db of keywords? or text strings?

best way would be to split up the string then match the parts and give an overall weighting then display results based off overall weightings..