From: [EMAIL PROTECTED]
> 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.
> 
> 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 

One of the columns is NULL ... which is mapped as undef in Perl. 
Therefore 
        print "@row\n";
gives you this warning.
 
> 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()

What is the DBI::dump_results($sth) there for?
You've already read all rows there were, what do you expect the 
dump_results() to print?

Jenda
---------------
As I said, I copied this verbatim from the example in the documentation. I
left it in because I hadn't seen any reason to remove lines I didn't
understand.

Thanks for the tip, though. I should be able to forge on ahead now.

-p


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

Reply via email to