use strict; use Win32::ODBC; # Connect to the database. my %ref; my $db = new Win32::ODBC("northwind" ); # Now retrieve data from the table. $db->Sql("SELECT customerid,companyname,contactname,city,phone,fax FROM Customers"); pageHeader(); while( $db->FetchRow() ) { undef %ref; %ref = $db->DataHash(); print "<TR><TD>$ref{'customerid'}</TD><TD>$ref{'companyname'}</TD>"; print "<TD>$ref{'contactname'}</TD><TD>$ref{'city'}</TD><TD>$ref{'phone'}</TD>"; print "<TD>$ref{'fax'}</TD></TR>\n"; } # Disconnect from the database. $db->Close(); pageFooter(); sub pageHeader() { print "Content-type: text/html\n\n"; print <<HEADER; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META NAME="description" CONTENT="Insert page description here"> <META NAME="keywords" CONTENT="Insert page keywords here"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"> <TITLE>Page Title</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function LoadPage() { //timevalue=setTimeout("document.CustInfoForm.submit()", 2000); } //--> </SCRIPT> </HEAD> <BODY bgcolor="black" text="white" onload="LoadPage()"> <!-- BODY bgcolor="black" text="white" //-> PERL <br> <TABLE border=1> <TR> <TH>customerid</TH> <TH>companyname</TH> <TH>contactname</TH> <TH>city</TH> <TH>phone</TH> <TH>fax</TH> </TR> HEADER } sub pageFooter() { print <<FOOT; </TABLE> <form method="post" name="CustInfoForm" action="northwind.pl"> <input type="submit" value = "rerun"> </form> </BODY> </HTML> FOOT }