in reply to Re^2: Perl database access
in thread Perl database access

The problem is you'll only get into the while if @comment_row is true, so testing if (@comment_row) inside the while is useless.

$comment_sth->execute($id) or die "Couldn't execute comment query: ".$DBI::errstr; my @comment_row; my $comment_count; while (@comment_row = $comment_sth->fetchrow_array) { my ($speedtrap_id,$comment_id,$comment_text,$comment_date,$commente +r) = @comment_row; $comment_count++; print <<EOF; <tr> <td colspan="2" bgcolor="#E6ECF0">$comment_text</td> </tr> EOF } print <<EOF unless ($comment_count); <tr> <td colspan="2" bgcolor="#E6ECF0">There are no comments from others fo +r this speedtrap.</td> </tr> EOF

Replies are listed 'Best First'.
Re^4: Perl database access
by awohld (Hermit) on Sep 23, 2004 at 19:59 UTC
    AWESOME! It works, thanks a lot!