i am very new to perl and i am experimenting with databases. I have written
a little script just to connect to a MySQL database, get a row and print
it. this is what i have:
#!/usr/bin/perl
use CGI::Carp "fatalsToBrowser";
use CGI ":all";
use DBI;
use CGI qw/:standard/;
$dbh = new CGI;
$dbh=DBI->connect("DBI:mysql:database=mysql:table=user;host=127.0.0.1;port=3306",edhunter,<mypassword>);
@data = $dbh->fetchrow_array;
$host = \@data[0];
print <<END_OF_HTML
content-type: text/html
<HTML>
<HEAD><TITLE>mats first database program</TITLE></HEAD>
<BODY>result: $host</BODY>
</HTML>
END_OF_HTML
everything is either from my Perl in a Nutshell book or from perldoc.com.
When i run this, i am getting:
Can't locate object method "fetchrow_array" via package "DBI::db" at
/web/misc/perl-lessons/database.cgi line 11.
what is wrong with it???
--
Matthew Harrison
Internet/Network Services Administrator
Peanut-Butter Cheesecake Hosting Services
Genstate
www.peanutbuttercheesecake.co.uk