#! f:/Perl/bin/perl -w use strict; use CGI qw(:standard); use DBI; my $dbh = DBI->connect('DBI:ODBC:Kunden'); my $cgi = CGI->new(); my %params = $cgi->Vars(); print $cgi->header(); if ( exists $params{suchanfrage} ) { &Suche ($cgi, \%params) } elsif( exists $params{eintrag} ) { &Eintragen($cgi, \%params) } else { &Startseite($cgi, '...') } print $cgi->end_html(); # ------------------------------------------------------------ sub Suche { my ($cgi, $params) = @_; my $dbh = &ConnectToDB(); $cgi->start_html('Antwort'); my $sqlStatement = qq§SELECT Tabelle1.Kundennummer, Tabelle1.Name, Tabelle1.Telefon, Tabelle2.Rechnungsbetrag FROM Tabelle2 JOIN Tabelle1 WHERE Tabelle2.Kundennummer = Tabelle1.Kundennummer~; my $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; my $sth = &FireSql($dbh, $sqlStatement); if ($sth->rows < 1) { print $cgi->p("Keine Daten gefunden"); return; } # if print qq~
Kundennummer: | Adresse: | Name: | Telefonnummer: | Rechnungsbetrag: |
%s | %s | %s | %s |