PHP Stripping!
Posted: Thu Jun 17, 2010 8:24 am
Good afternoon guys and girls.
I return with another problem after so long away!
I have a simple search engine on my site. You can see it in action at http://www.didymus.org.uk/tree
My PHP code only works on ONE word. If someone selects a Forename search and enters Paul, the code will return two matches. One for me (my middle name is Paul) and one for my Dad (whose first name is Paul).
But some people are entering things like Kristian Paul on a forename search and although this IS my name, because my search engine works only on one word, no results are returned.
So, enough babble. This is what I need to do.
I want my query.php to strip any spaces AND the characters that follow the spaces leaving just ONE word to search. For example if someone searches for:
Kristian Paul
the code accepts the word Kristian but deletes the space and the word Paul leaving..
Kristian
Sounds simple but I have no idea how to implement this. Have tried the PHP manual but to no avail!
Many thanks in advance.
KD.
I return with another problem after so long away!
I have a simple search engine on my site. You can see it in action at http://www.didymus.org.uk/tree
My PHP code only works on ONE word. If someone selects a Forename search and enters Paul, the code will return two matches. One for me (my middle name is Paul) and one for my Dad (whose first name is Paul).
But some people are entering things like Kristian Paul on a forename search and although this IS my name, because my search engine works only on one word, no results are returned.
So, enough babble. This is what I need to do.
I want my query.php to strip any spaces AND the characters that follow the spaces leaving just ONE word to search. For example if someone searches for:
Kristian Paul
the code accepts the word Kristian but deletes the space and the word Paul leaving..
Kristian
Sounds simple but I have no idea how to implement this. Have tried the PHP manual but to no avail!
Many thanks in advance.
KD.