$sth->execute() || die $sth->errstr; if ($sth->rows >= 0) { while ($pointer = $sth->fetchrow_hashref) { $ag = $pointer->{'name'}; $ag_save = $ag; if($ag){ print ""; } } } else { print ""; }