Solved

MySQL problem ..help

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can i Import Access Table Into Oracle Using Toad 36 225
ODBC Question 3 49
T-SQL: New to using transactions 9 46
Accessing variables in MySQL query 4 31
This article describes some very basic things about SQL Server filegroups.
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

829 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