#!/opt/lampp/bin/perl use DBI; print "Content-Type: text/html\n\n"; my $dsn="dbi:mysql:phonebook:localhost"; my $dbh=DBI->connect("$dsn","oswald","geheim") or die "Kann Datenbank nicht erreichen!"; print ""; print ""; print "Perl und MySQL"; print ""; print ""; print "

Perl und MySQL

"; print ""; print ""; print ""; print ""; print ""; print ""; my $query="SELECT * FROM users"; my $prep_sql=$dbh->prepare($query) or die print "Can't prepare"; $prep_sql->execute() or die print "Can't execute"; while (my @row = $prep_sql->fetchrow_array()) { print ""; print ""; print ""; print ""; print ""; } $prep_sql->finish(); $dbh->disconnect(); print "
VornameNachnameTelefonnummer
".$row[1]."".$row[2]."".$row[3]."
"; print ""; print "";