in reply to DBI - retrieving a specific row
Alternatively you fetch an array or array ref row by row with#get array ref my $results=$sth->fetchall_arrayref; #rec 4 is array element 3 due to the 0 element #my $field=$result->[row][fieldno] my $field1=$results->[3][0]; my $field2=$results->[3][1]; my $field3=$results->[3][2];
You can't retrieve record 4 only without a loop unless your sql statement returns only one record. You can usually specify the rows to return with a LIMIT clausemy @results=$sth->fetchrow_array; my $arrayref=$sth->fetchrow_arrayref;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: DBI - retrieving a specific row
by beebware (Pilgrim) on Feb 04, 2002 at 13:07 UTC |