in reply to Perl and SQL issue.
The reason the code doesn't go into the while loop is because the result set is empty! Some drivers may give you some meta data on the number of records returned (or you could use fetchall_hashref or fetchall_arrayref) or you could just use a sentinel:
$sth->execute() || die $sth->errstr; my $flag = 0; while ($pointer = $sth->fetchrow_hashref) { $flag++; ... } if( ! $flag ) { print "No records for ...." }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl and SQL issue.
by Anonymous Monk on Jun 28, 2007 at 13:21 UTC |