#!/usr/bin/perl -w
use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+
+
+my $dbh=&C4Connect;
+
my $template = HTML::Template->new(filename => 'searchresults.tmpl', die_on_bad_params => 0);
-$template->param(PET => 'Allie');
-$template->param(NAME => 'Steve Tonnesen');
+my @results;
+my $sth=$dbh->prepare("select * from biblio where author like 's%' limit 20");
+$sth->execute;
+while (my $data=$sth->fetchrow_hashref){
+ push @results, $data;
+}
+
+
-$template->param(SEARCH_RESULTS => [ { barcode => '123456789', title => 'Me and My Dog', author => 'Jack London', dewey => '452.32' },
- { barcode => '153253216', title => 'Dogs in Canada', author => 'Jack London', dewey => '512.3' },
- { barcode => '163214576', title => 'Howling at the Moon', author => 'Jack London', dewey => '476' }
- ]
+$template->param(SEARCH_RESULTS => \@results
);
<head><title>Test Template</title>
</head>
<body>
-Testing <TMPL_VAR NAME=NAME>
-<p>
-Pet's Name: <TMPL_VAR NAME=PET>
-<p>
-<hr>
<table border=1>
-<tr><th>Barcode</th><th>Title</th><th>Author</th><th>Dewey</th></tr>
+<tr><th>Title</th><th>Author</th><th>Biblionumber</th></tr>
<TMPL_LOOP NAME=SEARCH_RESULTS>
<tr>
- <td> <TMPL_VAR NAME=BARCODE> </td>
- <td> <TMPL_VAR NAME=TITLE> </td>
- <td> <TMPL_VAR NAME=AUTHOR> </td>
- <td> <TMPL_VAR NAME=DEWEY> </td>
+ <td> <TMPL_VAR NAME=title> </td>
+ <td> <TMPL_VAR NAME=author> </td>
+ <td> <TMPL_VAR NAME=biblionumber> </td>
</tr>
</TMPL_LOOP>
</table>