Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

RE: RE: Training wheels again

by le (Friar)
on Sep 10, 2000 at 20:06 UTC ( #31797=note: print w/replies, xml ) Need Help??

in reply to RE: Training wheels again
in thread Training wheels again

I don't know any Java, but if you want to give it a try, here's the code I used for the script.
#!/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", {RaiseE +rror => 1}); $r->send_http_header; print qq(<html> <head> <title>Adressbuch</title> </head> <body bgcolor="#ffffff"> ); print qq( <CENTER> <H1>Mein Adressbuch</H1> <A>Neuer Eintrag</A><BR><BR> <B>Suche nach:</B><BR> <FORM METHOD="POST"> <INPUT TYPE=text NAME=list SIZE=30> <INPUT TYPE=submit VALUE="Suche"> </FORM> <P> ); for ('A' .. 'Z') { print "<a href=\"/perl/adressen/?list=$_\">$_</a>&nbsp;\n"; } print "<br><br>\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, $telefon +2, $email, $id); $sth->bind_columns(\($nachname, $vorname, $strasse, $plz, $ort, $t +elefon1, $telefon2, $email, $id)); if ($sth->rows > 0) { print "<BR><BR>"; print "<H3>Gefundene Einträge:</H3>"; print "<TABLE border=0 cellpadding=5>"; print "<tr align=center><td><b>Name</b></td><td><b>Straße</b>< +/td><td><b>PLZ Ort</b></td><td><b>Telefon</b></td><td><b>eMail</b></t +d></tr>"; while ($sth->fetch) { print "<TR>"; print "<TD valign=top><B>$nachname $vorname</B></TD>"; print "<TD valign=top>$strasse</TD>"; print "<TD valign=top>$plz $ort</TD>"; print "<TD valign=top>$telefon1<BR>"; print "$telefon2</TD>"; print "<TD valign=top><I><A HREF=mailto:$email>$email</A>< +/I>"; print "</TD>"; print "<TD align=right valign=top><FONT SIZE=-1><A HREF=ch$id>&Auml;ndern</A>&nbsp;&nbsp;"; print "<A$id>L&ouml;schen</A></FONT></TD> +</TR>"; print "<TR><TD colspan=7><HR></TD></TR>"; } print "</table>\n"; } else { print "<h3>Nichts gefunden.</h3>\n"; } } print "</center>\n"; print qq( </body> </html> );

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://31797]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-11-30 21:03 GMT
Find Nodes?
    Voting Booth?