Name
DBI::fetchrow_array
Synopsis
@row_of_data = $statement_handle->fetchrow;
DBI::fetchrow
returns the next row of data from a
statement handle generated by DBI::execute
. Each
successive call to DBI::fetchrow
returns the next
row of data. When there is no more data, the function returns an
undefined value undef
. The elements in the
resultant array are in the order specified in the original query. If
the query was of the form SELECT
* FROM
. . ., the elements are ordered in the same sequence as the
fields were defined in the table.
Example
use DBI; my $db = DBI->connect('DBI:mSQL:mydata',undef,undef); my $query = "SELECT name, date FROM myothertable WHERE name LIKE 'Bob%'"; my $myothertable_output = $db->prepare($query); $myothertable_output->execute; my ($name, $date); # This is the first row of data from $myothertable_output. ($name, $date) = $myothertable_output->fetchrow_array; # This is the next row... ($name, $date) = $myothertable_output->fetchrow_array; # And the next... my @name_and_date = $myothertable_output->fetchrow_array; # etc...
Get MySQL and mSQL 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.