use strict; use warnings; use DBI; use CGI; my $dbh = DBI->connect("DBI:mysql:database=mygb;host=localhost;port=3306", "mygbuser", "mygbpw"); my $cgi = CGI->new; print $cgi->header; print $cgi->start_html(-title => 'MyGuestbook'); print $cgi->h1('MyGuestbook / Alle Eintraege'); my $sth = $dbh->prepare("SELECT email, username, message FROM entries"); $sth->execute; while(my $row = $sth->fetchrow_hashref) { print $cgi->ul({class => 'entrylist'} $cgi->li( $cgi->h1($cgi->a({href => $row->{'email'}}, $row->{'username'})), $cgi->div($row->{'message'}) ) ); } print $cgi->end_html;