Hi,
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 ? ("<ol>", "</ol=
>") : ("<ul>", "</ul>");
print $list_opener;
}
# display the records as <li> entries
}
}
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
--
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 [at] m.gmane.org
