#!/usr/bin/perl -w use strict; #use CGI; use DBI; use HTML::Template; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Datenbankdaten und Verbindung zur DB herstellen # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Datenbank my $datenbank = "info"; # Datenbankhost my $datenbankhost = "127.0.0.1"; # Datenbankusername my $datenbankuser = "root"; # Datenbankpasswort my $datenbankpw = ""; my $dbh = DBI->connect("DBI:mysql:$datenbank:$datenbankhost","$datenbankuser","$datenbankpw") or die "Fehler bei der Datenbankverbindung aufgetreten."; #my $CGI = CGI->new(); my $sth = $dbh->prepare('select Monat, Tag, Zeit, Host, Dienst, Meldung from infotable'); $sth->execute(); my $rows; push @{$rows}, $_ while $_ = $sth->fetchrow_hashref(); my $template = HTML::Template->new(filename => 'template1.html'); $template->param(data => $rows); #print $CGI->header(); print "Content-Type: text/html\n\n"; print $template->output(); $dbh->disconnect();