Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MySQL problem ..help

Posted on 2001-07-12
2
Medium Priority
?
994 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 120 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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

In this article, we’ll look at how to deploy ProxySQL.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

782 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