The reason this doesnt do what you expect it to do is because you are
calling your function, which is then executing your SQL command and
returning the first recordset.
You are doing this over and over again - instead you should have some sort
of loop in your function that loops through ALL the
Hello Charlie,
[snip]
> ===
>
> This is my function attempting to do the same thing(?).
>
> sub Comment() {
>
> my( $sth );
>
> $sth = $dbh->prepare("SELECT comment from dbtable
> where com
I'm trying to get a grip on functions.
I want to connect to a database, execute a SELECT statement, and print
each line where the criteria is met.
This does what I want.
my $comment;
while ( $comment = $sth->fetchrow_array) {
print "$comment\n";
}
===