Re: Search witin text.
| From: | Christopher Blöcker | Date: | Sun, 11 Feb 2007 10:01:56 +0000 |
| Subject: | Re: Search witin text. | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43059@lists.php.net to get a copy of this message | ||
you can use explode
from php.net:
as delimiter you would use a space character in this case. for example: the user input is $input = "Chris Carter"; now you can $split = explode(" ", $input); so $split would be an array that contains ["Chris", "Carter"] now you can persorm your search using $split[0] and/or $split[1] ;) I hope that's what you're looking for Chris Carter wrote:array *explode* ( string $delimiter, string $string [, int $limit] ) Returns an array of strings, each of which is a substring of /string/ formed by splitting it on boundaries formed by the string /delimiter/. If /limit/ is set, the returned array will contain a maximum of /limit/ elements with the last element containing the rest of /string/. <<
Thanks much ... this has been achieved now. However, there is another issue. Say for example, the user wants to search 'Chriscarter' but puts into the search field 'Chris Carter' how is it that I can take only the 'Chris' out of the search string and present the matching searches from the database? Any clue or link would be of great assistance. Thanks again.