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
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]