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 8348 Jan 18, 2002, 5:28 AM
Thread Re: [jiliu] searching for multiple words
604 8204 Jan 18, 2002, 9:57 AM
Thread Re: [TheStone] searching for multiple words
jiliu 8197 Jan 18, 2002, 10:08 AM
Thread Re: [jiliu] searching for multiple words
604 8211 Jan 18, 2002, 10:24 AM
Thread Re: [TheStone] searching for multiple words
jiliu 8216 Jan 18, 2002, 10:33 AM
Thread Re: [jiliu] searching for multiple words
604 8208 Jan 18, 2002, 10:48 AM
Post Re: [TheStone] searching for multiple words
jiliu 8155 Jan 18, 2002, 11:12 AM
Thread Re: [TheStone] searching for multiple words
Reena0330 8028 Aug 7, 2002, 3:25 PM
Thread Re: [Reena0330] searching for multiple words
604 8063 Aug 7, 2002, 3:41 PM
Thread Re: [TheStone] searching for multiple words
jai 7797 Feb 10, 2003, 9:22 PM
Post Re: [jai] searching for multiple words
604 7814 Feb 11, 2003, 10:34 AM
Post Re: [jai] searching for multiple words
604 7704 Feb 28, 2003, 4:32 PM