July 1999
Intermediate to advanced
502 pages
19h 52m
English
DBI::fetchrow_array
@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.
Exampleuse 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...Read now
Unlock full access