----- Original Message -----
From: "Simon Oliver" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 01:33
Subject: Re: Single value


> "In a scalar context, fetchrow_array returns the value of the first
field."
>
> $val = $sth->fetchrow_array;
>
> Alternatively, you could use a bind_col thus:
>
> my $val;
> $sth->bind_col(1, $val);

That should be $sth->bind_col(1, \$val);

I personally prefer to uset $sth -> bind_columns( \( $var ) );.  It's a
slightly more work for DBI, but I only have to remember one method
regardless of the number of columns.

> while ($sth->fetch) {
>    print "$val\n";
> }


Reply via email to