You might consider Apache::DBI.  I hear it does what you're interested in doing,
but I haven't done much research on it.  Good luck!

Check out search.cpan.org :)

C.J.

cpan> i Apache::DBI
Module id = Apache::DBI
    DESCRIPTION  Persistent DBI connection mgmt.
    CPAN_USERID  MERGL (Edmund Mergl <[EMAIL PROTECTED]>)
    CPAN_VERSION 0.88
    CPAN_FILE    M/ME/MERGL/ApacheDBI-0.88.tar.gz
    DSLI_STATUS  bmpO (beta,mailing-list,perl,object-oriented)
    INST_FILE    (not installed)


Marcus Willemsen wrote:

> Hi I'm new to Perl and programming in general,
>
> I wrote (with the help of Learning Perl) the following cgi-scripte to get
> headlines out of a database called Message. And it works okay. The next step
> would be to enable a user to click on the headline that interest him and to
> display the rest of the message. Can I acess the result of my first search
> somehow and pass it on to an new search??
>
> Best regards
>
> Marcus
>
> 1  #!/usr/bin/perl -w
> 2
> 3  use DBI;
> 4  use CGI qw(:standard);
> 5  use CGI::Carp(fatalsToBrowser);
> 6
> 7  print header, start_html("Search"), h1("Search the database");
> 8
> 9  if (param()) {
> 10 $word = param("search");
> 11 $datasource = "DBI:mysql:messages;host=localhost;";
> 12 $user = "xxx";
> 13 $passw = "xxx";
> 14 $dbh = DBI->connect($datasource, $user, $passw, {'RaiseError' => 1});
> 15 $sth = $dbh->prepare("SELECT Header FROM Message WHERE Header LIKE
> '%$word%' GROUP BY Date");
> 16 $sth->execute();
> 17 while($row = $sth->fetchrow_hashref()) {
> 18      print p("$row->{'Header'}\n");
> 19 }
> 20 print p();
> 21 print hr();
> 22 print start_form();
> 23 print p("New Search", textfield("search"));
> 24 print p(submit("Here we go!"), reset("Reset"));
> 25 print end_form();
> 26 } else {
> 27 print hr();
> 28 print start_form();
> 29 print p("Search for: ", textfield("search"));
> 30 print p(submit("Here we go!"), reset("Reset"));
> 31 print end_form();
> 32 }
> 33 print end_html;

Reply via email to