prince26121991 has asked for the wisdom of the Perl Monks concerning the following question:
Getting error in this code! i.e. Not an ARRAY refrence at C:/Perl/Site/lib/DBI.pm line 2086#!C:\perl\bin\perl.exe -w use DBI; use CGI; use HTML::Template; my $cgi = CGI->new; my $dbh = DBI->connect('dbi:mysql:perltest', 'root'); my $t = HTML::Template->new(filename => 'db.tmpl'); $rows = $dbh->selectall_hashref('select id, name, price from products' +,{ Slice => {} } ); foreach my $row (@$rows) { my $id = $row->{id}; my $name = $row->{name}; my $price = $row->{price}; } $dbh->disconnect; print $cgi->header; print $t->output;
P.S.-Please Answer in simple language Because I am just beginner
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Not An Array reference
by LanX (Saint) on Nov 15, 2013 at 20:48 UTC | |
|
Re: Not An Array reference
by tangent (Parson) on Nov 15, 2013 at 21:55 UTC |