#!/usr/bin/perl -w use DBI; use strict; # Create a new Apache request object my $r = shift; # Set up the parameter hash my %q = $r->method eq "GET" ? $r->args : $r->content; my $dbh = DBI->connect("DBI:mysql:adressen", "user", "secret", {RaiseError => 1}); $r->send_http_header; print qq(
);
for ('A' .. 'Z') {
print "$_ \n";
}
print "
\n";
if ($q{"list"}) {
my $search = $q{list};
my $sth = $dbh->prepare("SELECT * FROM list WHERE nachname LIKE ? ORDER BY nachname");
$sth->execute("$search%");
my ($nachname, $vorname, $strasse, $plz, $ort, $telefon1, $telefon2, $email, $id);
$sth->bind_columns(\($nachname, $vorname, $strasse, $plz, $ort, $telefon1, $telefon2, $email, $id));
if ($sth->rows > 0) {
print "
";
print "
Name | Straße | PLZ Ort | Telefon | |||
$nachname $vorname | "; print "$strasse | "; print "$plz $ort | "; print "$telefon1 "; print "$telefon2 | ";
print "$email"; print " | "; print "Ändern "; print "Löschen | |