Name

fetchrow_array( )

Synopsis

$statement_handle->fetchrow_array( )

This returns one row from the results of a statement handle in the form of an array, each of whose element is a column.

...
my $sql_stmnt = "SELECT title, author FROM books";
my $sth = $dbh->prepare($sql_stmnt);
$sth->execute( );
while (my ($title, $author) = $sth->fetchrow_array( ){
   print "$title by $author \n";
}
$sth->finish( );

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.