arunvelusamy has asked for the wisdom of the Perl Monks concerning the following question:
I tried to use HTML::Pager to display my database contents. The contents are displayed but navigation doesnot work. I have given my code below.
#!/usr/bin/perl #uses use strict; use warnings; use diagnostics; use DBI; use CGI; use HTML::Pager; #Declare Variables my $query=CGI->new(); my $count=0; #Fetch DB Connects my $get_data_sub = sub { my (@return_array,@data); #connect db & prepare stmt my $dbHandle = DBI->connect("dbi:mysql:tempdb","user","password +") or die ("Cannot Connect to database"); my $stmtHandle = $dbHandle->prepare("select sno,name,age,deptno + from sample1"); #fetch content from Database $stmtHandle->execute(); while(@data=$stmtHandle->fetchrow_array()) { push(@return_array, [@data]); } #disconnect db $stmtHandle->finish(); $dbHandle->disconnect(); return \@return_array; }; #Pager my $pager = HTML::Pager->new(query=>$query, get_data_callback => $get_data_sub, rows => 11, page_size =>5, cell_space_color => '#000000', cell_background_color => '#ffffff', debug => 1 ); print "Content-Type: text/html\n\n"; print $pager->output;
Thanks, arunvelusamy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Pager, Navigation not working
by perl_lover (Chaplain) on Oct 24, 2005 at 12:51 UTC | |
|
Re: HTML::Pager, Navigation not working
by sacked (Hermit) on Oct 24, 2005 at 20:51 UTC |