#!/usr/bin/perl -w use DBI; use CGI::Carp qw(fatalsToBrowser); use ModTest; print "Content-type:text/html\n\n"; my $sql_dbh = ModTest->connect_mysql(); my $sql = "SELECT * FROM table"; my $st = $sql_dbh->prepare($sql) or die "Preparing MySQL query failed: $DBI::errstr"; $st->execute() or die "The execution of the MySQL query failed: $DBI::errstr"; while ($row = $st->fetchrow_hashref()) { print " $row->{first} $row->{last}"; } $sql_dbh ->disconnect();