HI all, I am getting the error "Can't use string ("query") as a HASH ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.8/Data/Pager.pm line 30."
with the following code (The area I think is causing the problem is red...):
This is driving me batty, any and all suggestions greatly appreciated.....
Jim
with the following code (The area I think is causing the problem is red...):
This is driving me batty, any and all suggestions greatly appreciated.....
Jim
Code:
my $query=CGI->new();
my $count=0;
my $get_data_sub = sub {
my (@return_array,@data);
my $dbname = "DBI:mysql:farthing_valleyweb";
my $dbusername = "farthing_farthin";
my $dbpassword = "ginajim";
my $dbHandle = DBI->connect($dbname, $dbusername, $dbpassword)
or die "Can't connect: ", $DBI::errstr;
$dbh->{RaiseError} = 1;
my $stmtHandle = $dbHandle->prepare('select * from valley where category like "Real Estate" LIMIT 3,3;');
$stmtHandle->execute();
while(@data=$stmtHandle->fetchrow_array())
{
push(@return_array, [@data]);
}
$stmtHandle->finish();
$dbHandle->disconnect();
return \@return_array;
};
[COLOR=red]
my $pager = Data::Pager->new(query=>$query,
get_data_callback => $get_data_sub,
rows => 11,
page_size =>5
);
[/color]
print "Content-Type: text/html\n\n";
print $pager->output;