#!/usr/bin/perl -w use CGI qw(:standard); use DBI; use strict; my @list = ''; print header; print start_html; my $dbh = DBI->connect('DBI:mysql:test') or die "Trouble opening database: $DBI::errstr; stopped"; my $sth = $dbh->prepare("SELECT name, data, ID FROM frog WHERE ID like '%'") or die "Trouble preparing statement: $DBI::errstr; stopped"; $sth->execute() or die "Trouble executing statement: $DBI::errstr; stopped"; while ( my ($blankfield, $data) = $sth->fetchrow_array() ) { push @list, $data; } my $i = $#list; while ($i >= ($#list - 2)) { print $list[$i--], "
\n"; } $dbh->disconnect(); print end_html;