Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

RE: Training wheels again

by BastardOperator (Monk)
on Sep 09, 2000 at 00:58 UTC ( [id://31676]=note: print w/replies, xml ) Need Help??


in reply to Training wheels again

I don't suppose there's any chance that you could bring Java into the mix and see how a servlet under Apache compares? I don't mean to start everyone off bringing every language under the sun (pun intended) into the mix, but with Java pushing so hard to be _the_ solution for web/db applications, I'd love to see what it can do. Maybe if you post the code, I can whip something up, though my Java skills would most likely give a definite advantage to Perl and PHP ;).

Replies are listed 'Best First'.
RE: RE: Training wheels again
by le (Friar) on Sep 10, 2000 at 20:06 UTC
    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 HREF=addnew.pl>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 +ange.pl?id=$id>&Auml;ndern</A>&nbsp;&nbsp;"; print "<A HREF=kill.pl?id=$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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-16 14:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found