in reply to Extra iteration while fetching 'fetchrow_array' in DBI and standerd way of using DBI
SELECT *I would replace that with
to ensure that you get the columns in the order you expect.SELECT column1, column2, ..
Continue down the same road with the fetch:
while ( my @arr = $sth->fetchrow_array() )I would replace that with
This way I'm certain that my variables correspond to the values by name, not just by their position in the array.while ( my $href = $sth->fetchrow_hashref() ) { my $col1 = $href->{column1}; my $col2 = $href->{column2}; ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extra iteration while fetching 'fetchrow_array' in DBI and standerd way of using DBI
by runrig (Abbot) on Jun 15, 2007 at 17:38 UTC | |
by roboticus (Chancellor) on Jun 16, 2007 at 04:22 UTC |