Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [jiliu] searching for multiple words

Quote Reply
Re: [jiliu] searching for multiple words In reply to
Hi,

Just modify letter_search subroutine in LetterSearch plugin which I sent you:

....
my $db = $home->{cgi}->{db};
my $table = $DB->table($db);
$table->select_options("Order by $column",$limit);
my $cond;
my $words = [split /\s/,$letter];
$cond = GT::SQL::Condition->new ();
$cond->{bool} = 'OR';
foreach (@$words) {
($_) and $cond->add($column,'LIKE',"%$_%");
}
my $sth = $table->select ($cond);
my $hits = $table->hits();
....
And then create a link db.cgi?do=search_results&db=<%db%>&let=black%20white&col=column_name or you can create a form for searching words.

Hope that helps,

TheStone.

B.
Subject Author Views Date
Thread searching for multiple words jiliu 6654 Jan 18, 2002, 5:28 AM
Thread Re: [jiliu] searching for multiple words
604 6533 Jan 18, 2002, 9:57 AM
Thread Re: [TheStone] searching for multiple words
jiliu 6527 Jan 18, 2002, 10:08 AM
Thread Re: [jiliu] searching for multiple words
604 6543 Jan 18, 2002, 10:24 AM
Thread Re: [TheStone] searching for multiple words
jiliu 6544 Jan 18, 2002, 10:33 AM
Thread Re: [jiliu] searching for multiple words
604 6536 Jan 18, 2002, 10:48 AM
Post Re: [TheStone] searching for multiple words
jiliu 6486 Jan 18, 2002, 11:12 AM
Thread Re: [TheStone] searching for multiple words
Reena0330 6358 Aug 7, 2002, 3:25 PM
Thread Re: [Reena0330] searching for multiple words
604 6390 Aug 7, 2002, 3:41 PM
Thread Re: [TheStone] searching for multiple words
jai 6125 Feb 10, 2003, 9:22 PM
Post Re: [jai] searching for multiple words
604 6146 Feb 11, 2003, 10:34 AM
Post Re: [jai] searching for multiple words
604 6037 Feb 28, 2003, 4:32 PM