Hi,
Do you mean something like this:
get_results_like
Code:
sub {
my $ID = $_[0];
my $option1 = $_[1];
my $option2 = $_[2];
my $option3 = $_[3];
my $option4 = $_[4];
my $option5 = $_[5];
my $cond = new GT::SQL::Condition;
if ($option1) {
$cond->add("Address","LIKE","%$option1%");
}
if ($option2) {
$cond->add("Address","LIKE","%$option2%");
}
if ($option3) {
$cond->add("Address","LIKE","%$option3%");
}
if ($option4) {
$cond->add("Address","LIKE","%$option4%");
}
if ($option5) {
$cond->add("Address","LIKE","%$option5%");
}
$cond->bool('OR');
my $sth = $DB->table('CatLinks','Links')->select ( { 'CatLinks.CategoryID' => $ID }, $cond ) || die $GT::SQL::error;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
return { result_link_loop => \@loop };
}
Then call with:
Code:
<%get_results_like($ID,'something','something else','something else','something else','something else')%>
<%if result_link_loop.length%>
<%loop result_link_loop%>
<%include link.html%>
<%endloop%>
<%endif%>
Untested, but should work.
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work! Want to give me something back for my help? Please see my
Amazon Wish List GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500) Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin |
Pre-Made Template Sets |
FREE GLinks Plugins! Compare our different Plugin packages *new* Free CSS Templates