fetch()
$sth->fetch()This function returns a reference to an array of one row from
the results of a statement handle. It’s similar to
fetchrow_array() except that it requires the
use of bind_col() or
bind_columns() for setting variables to
values fetched. There are no arguments for this function. Here is an
example:
...
my $sql_stmnt = "SELECT title, author FROM books";
my $sth = $dbh->prepare($sql_stmnt);
$sth->execute();
my ($title, $author);
$sth->bind_columns(\$title, \$author);
while( $sth->fetchrow_array()) {
print "$title by $author \n";
}
...