[San-Diego-pm] Stuck again

Christopher Grau chris.grau at gmail.com
Mon Dec 19 11:35:17 PST 2016


The fetchall_arrayref() method is attached to the statement handle ($sth)
rather than the database handle ($dbh).

On Mon, Dec 19, 2016 at 10:29 AM, Joel Fentin <joel at fentin.com> wrote:

> I'm trying to modify Perl code I wrote years ago. First I have to get it
> running as is. It won't.
>
> ---------------
>
> my $ref=$dbh->selectall_arrayref("SELECT * FROM titulo LIMIT 10");
>
> There is no error and no data.
>
> This works on a website on BlueHost.
> It also works on a personal server in an old computer using old windows,
> old Perl, old Apache, & old MySQL.
>
> ---------------
>
> So then, I tried something newer:
>
> $sth = $dbh->prepare("SELECT * FROM titulo LIMIT 10");
> $sth->execute()||($error="Error:$DBI::errstr\n");
> $ref=$dbh->fetchall_arrayref();
> The error: Can't locate object method "fetchall_arrayref" via package
> "DBI::db" at C:/Apache2.2/cgi-bin/PacoWeb/CDsearch.pl line 285
>
> (There is a use DBI; statement at the start of the program.)
>
> Any help/ideas/wisdom/suggestions appreciated.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/san-diego-pm/attachments/20161219/e10e7f80/attachment.html>


More information about the San-Diego-pm mailing list