Problems with DBI 
Author Message
 Problems with DBI

I can't get the code below (from perl.com) to work. can anyone help?
The error messages follows the code below.

------------------ CODE -------------------
#!/usr/bin/perl -w

use DBI;
use strict;
use diagnostics;

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

my $database = 'db1';
my $user = 'u1';
my $password = 'p1';
my $dbh = DBI->connect("dbi:mysql:$database",$user,$password);
my $sth = $dbh->do(qq{SELECT * FROM pet});


print "qw($row[0]\t$row[1]\t$row[2]\n";

Quote:
} # this part is not exactly like the perl.com code but that gave me the

same error #message.

$dbh->disconnect;
1;

---------- ERROR MESSAGE -------------------
Can't call method "fetchrow_array" without a package or object reference at
line 15 (#1)

    (F) You used the syntax of a method call, but the slot filled by the
    object reference or package name contains an expression that returns
    a defined value which is neither an object reference nor a package name.
    Something like this will reproduce the error:

        $BADREF = 42;
        process $BADREF 1,2,3;
        $BADREF->process(1,2,3);

Uncaught exception from user code:
        Can't call method "fetchrow_array" without a package or object
reference at line 15.
Database handle destroyed without explicit disconnect.

---------------------------------------------------

Can anyone help? Please.



Sat, 21 Jun 2003 03:31:55 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Problems with DBI and DBD::XBase

2. problem with DBI:Oracle

3. Problem with DBI

4. Problem building DBI with perl5.001

5. Problems installing DBI module in Windows 95

6. Problem closing dbi connections in a cgi script

7. Problem with DBI+DBD MySQL, using fetchall_arrayref and dereferencing with random function

8. Problem installing DBI

9. problem with DBI.

10. Update problem with DBI-ODBC and MSAccess

11. problems with DBI on Win Nt an MSSQL on TEXT fields

12. Problem using DBI/DB2 on Windows

 

 
Powered by phpBB® Forum Software