Hiya fellow Perlheads, 

I've been lurking for a few months and figured I'd pose a question that I've
been banging my head against for a while. I have tried googling and I have R
the FM, but I can't find any clear indication of what the problem with the
code below is. This error message I get back is particularly disturbing
because I have copied the code verbatim from the perldoc for DBI (other than
variablename changes). (Code and output are after message body.)

As you can see, it *does* fetch and return the record I ask for. I just
don't understand why I'm getting error messages.

Also, I have seen $DBI->errstr and $DBI::errstr as different notations for
the same thing. The former appears to be an archaic notation, and the latter
seems to, well, work. (Just thought I'd throw that out there for anyone else
new to DBI who may be looking at lousy tutorials.)

If anyone can recommend a good resource for DBI information I would be
eternally grateful.

Cheers,
Peter

CODE:
------------
#!/usr/bin/perl -w 
use DBI; 
use strict; 

my $dbh = DBI->connect("DBI:mysql:ADA","root","password") or die "Unable to
connect to ADA: $DBI::errstr\n"; 


  $sth = $dbh->prepare("SELECT * FROM station WHERE cruise=?");
  $sth->execute( "cruise" );
  while ( @row = $sth->fetchrow_array ) {
    print "@row\n"; # THIS IS LINE 11.
  }

DBI::dump_results($sth) or die "$DBI::errstr\n"; 
$sth->finish; 
$dbh->disconnect; 
exit; 
__END__ 

OUTPUT:
--------------
Use of uninitialized value in join or string at sqltest.pl line 11.
1 name t 0 0 0000-00-00 0000-00-00 0 0 cruise 0 

0 rows (19: fetch() without execute())
DBD::mysql::st fetch failed: fetch() without execute() at
C:/Perl/site/lib/DBI.pm line 830.
fetch() without execute()

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to