Hi Jian,
You should modify your script like:
else {
$cond->add($column,'LIKE',"$letter%");
}
my $cols = $table->cols;
my $c = GT::SQL::Condition->new();
foreach ( keys % $cols ) {
if ( $home->{cgi}->{$_} ) {
my $opt = $home->{cgi}->{"$_-opt"} || 'LIKE';
( $opt eq 'LIKE' ) ? $c->add($_, $opt, "$home->{cgi}->{$_}%") : $c->add($_, $opt, $home->{cgi}->{$_});
}
}
my $sth = $table->select (GT::SQL::Condition->new($c, $cond));
Hope that helps.
TheStone.
B.
You should modify your script like:
Code:
... else {
$cond->add($column,'LIKE',"$letter%");
}
my $cols = $table->cols;
my $c = GT::SQL::Condition->new();
foreach ( keys % $cols ) {
if ( $home->{cgi}->{$_} ) {
my $opt = $home->{cgi}->{"$_-opt"} || 'LIKE';
( $opt eq 'LIKE' ) ? $c->add($_, $opt, "$home->{cgi}->{$_}%") : $c->add($_, $opt, $home->{cgi}->{$_});
}
}
my $sth = $table->select (GT::SQL::Condition->new($c, $cond));
Hope that helps.
TheStone.
B.