Hi, I am new to the Html-template and perl. How can I show the resultset to the web page which Shows 10 records per page and also page numbers on the bottom of the table?
This is my perl codes; #!perl use DBI; use strict; use CGI qw/:standard/; use HTML::Template; # open the html template my $template = HTML::Template->new(filename => 'temp.tmpl'); my $username = "mm"; my $password = "kk"; my $dsn = "DBI:mysql:database:localhost"; my $dbh = DBI->connect($dsn,$username,$password) or die "Cannot connect to database: $DBI::errstr"; my $search = param('search'); my $sql ="SELECT * FROM database where name like '$search%' or last like '$search%'"; my $sth = $dbh->prepare($sql); $sth->execute() or die "Cannot execute sth: $DBI::errstr"; # a reference to the array of results my $tbl_ary_ref = $sth->fetchall_arrayref({}); # cleanup $sth->finish; $dbh->disconnect; # assign the reference to the results to a h::t var called results $template->param(results => $tbl_ary_ref); print "Content-Type: text/html\n\n", $template->output(); my 'temp.tmpl' is: <!-- loop over results --> <tmpl_loop name=results> <tr> <td align="center"><tmpl_var Name=name></a></td> <td align="center"><tmpl_var name=last></a></td> </tr> </tmpl_loop> Many thanks, MK ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users