Home : Products : DBMan SQL : Discussion :

Products: DBMan SQL: Discussion: Re: [jiliu] searching for multiple words: Edit Log

Here is the list of edits for this post
Re: [jiliu] searching for multiple words

Alright, just make a little change:

my $db = $home->{cgi}->{db};
my $table = $DB->table($db);
$table->select_options("Order by $column",$limit);
my $cond = GT::SQL::Condition->new ();
if ($home->{cgi}->{mul}) { #search words
my $words = [split /\s/,$letter];
$cond->{bool} = 'OR';
foreach (@$words) {
($_) and $cond->add($column,'LIKE',"%$_%");
else { # search starting with a letter
my $sth = $table->select ($cond);
my $hits = $table->hits();

It should work for both, if you wanna search words then pass mul=1 or add <input name=mul value=1 type=hidden> in your search form.




Last edited by:

TheStone: Jan 18, 2002, 10:53 AM

Edit Log: