Solved

MySQL problem ..help

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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…

911 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

16 Experts available now in Live!

Get 1:1 Help Now