Solved

MySQL problem ..help

Posted on 2001-07-12
2
971 Views
Last Modified: 2012-06-21
Hi

I have this chunk of code that i am trying to run using Perl via MySQL and I am having the following error :

Can't call method "fetchall_array" without a package or object reference .

please find below the perl script :

#!/usr/bin/perl

use DBI;

print "Content-type:text/html\n\n";

$dbh = DBI->connect("DBI:mysql:bakrico_com","bakrico","Fz7GJ75e");

my ($sth,@arr);

$sth=$dbh->do("select * from test");
$dbh->disconnect;
while(@arr = $sth->fetchall_array)

  {
  $names.="$arr[0],$arr[1],$arr[2],$arr[3],<br>";
 }

print $names;
##############################/

any ideas ???
0
Comment
Question by:zeon1234
  • 2
2 Comments
 
LVL 15

Accepted Solution

by:
a.marsh earned 30 total points
ID: 6277549
I'm afraid I'm not a Perl person, but using my general experience, could the problem be the fact that you are disconnecting from the database BEFORE using the resultset?

I would move:

$dbh->disconnect;

further down the script when you have finished with the data.

:o)

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6280983
Glad to help.

:o)

Ant
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question