Implode, explode and spaces problem
| From: | Kenneth Bogucki | Date: | Thu, 17 Aug 2000 15:15:19 +0000 |
| Subject: | Implode, explode and spaces problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12253@lists.php.net to get a copy of this message | ||
I have a simple and complex search at one of our sites...in the simple
search the user can search for all the words (AND) or any of the words
(OR) using the standard one line text field common at most sites. The
routines were written to check the query, make sure there are no odd
characters, words less than three characters or restricted words.
We explode the query on the basis of spaces, run varies checks on the
keywords then implode the statement inserting the AND or OR and spaces
as required. The problem is spaces.
The rountine will not pick up an error with a query like:
"(space)KEYWORD(space)(space)(space)KEYWORD(space)"
The routine will try to contruct a query for the mysql like:
"(space) AND (space) AND KEYWORD" etc etc.......obviously this query
will not run properly.
Any idea on how to solve the problem would be a big help:
ken