#!/usr/bin/perl -w # perl modules use CGI; use DBI; use strict; use diagnostics; # setup CGI handle my $cgi = new CGI; # start HTML print $cgi->header; my $dsn = 'DBI:mysql:mydb:localhost'; my $db_user_name = 'mydbusername'; my $db_password = 'mydbpassword'; my $dbh = DBI->connect($dsn, $db_user_name, $db_password); my $sth = $dbh->prepare(qq{select user, topic, topictest from pagedata}); $sth->execute(); while (my ($username, $topic, $topictext) = $sth->fetchrow_array()) { print "$username, $topic, $topictext"; } $sth->finish(); $dbh->disconnect();