On Thu, 2003-12-18 at 08:40, Mace, Richard wrote:
>
> $sth = $dbh->prepare("SELECT telephone from sample");
> $sth->execute();
> $sth->bind_columns(undef, \$telephone);
> while ( $sth->fetch ) {
> print STDERR "$telephone\n";
> }
> $sth->finish;
>
> This fails with "Statement has no result to bind(perhaps you need to
> call execute first)"
>
> This code works fine for a field that is always populated e.g. name in
> place of telephone in line 1.
If a cell is NULL, I think it is undefined in DBI
Try changing your select to
SELECT telephone from sample WHERE telephone IS NOT NULL