#!/usr/bin/perl use DBI; print "Content-type: text/html\n\n"; #this line connects to the database. It should have the #database name, the username, and the password #replace the values here with the correct values for your system $dbh = DBI->connect("dbi:Pg:dbname=YOUD-DBNAME", "username", "password"); $result = $dbh->prepare("select filmid,title from titles"); $result->execute(); $filmid1 = ""; $title1 = "" ; $result->bind_columns(undef, \$filmid1, \$title1); while ($result->fetch() ) { print "$filmid1, $title1
\n"; }