Gossamer Forum
Home : Products : Gossamer Links : Discussions :

if statement in global

Quote Reply
if statement in global
I use this global, and the if statment is never work even when there is a value to the uid.
Code:
sub {
use GT::SQL::Condition;
my $total = 0;
my $qqq = $_[2];
my $aaa = $_[3];
my $uid = $_[4];

my $tbl = $DB->table('FormDetails');
$tbl->select_options("ORDER BY ID DESC Limit $qqq, $aaa");
my $cond = new GT::SQL::Condition;
my $cond = GT::SQL::Condition->new($_[0] => $_[1]);
my $cond2 = new GT::SQL::Condition;

if ($uid)
{
my $cond2 = GT::SQL::Condition->new( Username => $_[4]);}

my $sth = $tbl->select( $cond, $cond2 ) || return $GT::SQL::error;
$total = $tbl->hits;

my @back;
while (my $hit = $sth->fetchrow_hashref) {
push @back, $hit;
} my $exists; if ($back[0]) { $exists = 1; } else { $exists = ''; }
return { lead_loop => \@back, link_count => $total} }
Subject Author Views Date
Thread if statement in global nir 2860 Jul 3, 2015, 12:51 PM
Post Re: [nir] if statement in global
Andy 2815 Jul 4, 2015, 6:21 AM