Evaluating first row fetched
am 22.01.2005 14:22:11 von Jan EdenHi,
I have to print either an ordered or an unordered list of items, dependent =
of the value of a certain field of the first row returned. Since there are =
a lot of rows to fetch, I cannot use fetchall_arrayref/hashref.
I currently use the following code:
my $sth =3D $dbh->prepare($query);
$sth->execute();
my ($list_opener, $list_closer);
while (my ($list_id, $list_title, $visible, $list_user_id, $position) =3D $=
sth->fetchrow_array) {
if ($visible || $mode eq 'edit') {
unless ($list_opener) {
($list_opener, $list_closer) =3D $position ? ("
- ", "
- ", "
print $list_opener;
}
# display the records as
}
}
print $list_closer;
Is there a more elegant way to evaluate the value of field "position" of th=
e first row outside the while loop?
Thanks,
Jan
--=20
There are 10 kinds of people: those who understand binary, and those who d=
on't
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org