Solved

MySQL problem ..help

Posted on 2001-07-12
2
938 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now