Feedback
| From: | jtjohnston | Date: | Wed, 07 Nov 2001 06:16:07 +0000 |
| Subject: | Feedback | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73673@lists.php.net to get a copy of this message | ||
Hi,
Could you give me some feedback on this code please?
I don't really understand what is going on with $type and $val
Here is what I have done so far:
http://www.collegesherbrooke.qc.ca/languesmodernes/ccl/match.php
http://www.collegesherbrooke.qc.ca/languesmodernes/ccl/do_boolean_search.inc
To get it to work, I had to do this:
--------------snip--------------------
$where = "";
$words = explode(" ", $searchenquiry);
foreach ($words as $val)
{
if (strlen($where) > 0) $where .= " $type ";
$where .= "YR like \"%$val%\"";
}
$where = str_replace("YR like \"%AND%\"", "AND",
$where);<==MY
HACK
--------------snip--------------------
I know my adding str_replace was not what was originally meant.
If you have a moment, can you explain $type and $val and maybe where I
need to go right?
John
> // assume AND/OR coming in in $type
> // $searchme is another input
> $where = "";
> $words = explode(" ", $searchme);
> foreach ($words as $val)
> {
> if (strlen($where) > 0) $where .= " $type ";
> $where .= "field like '%$val%'";
> }
> // now tap $where on to your sql statement