On Thu, 31 May 2001 19:29:12 +0800 (PHT), Orlando Andico wrote:
>On Thu, 31 May 2001, [iso-8859-1] Hèctor Alòs i Font wrote:
>..
>> Simply something as simple as :
>>
>> $sth = $dbh->prepare ("select FIELD from TABLE where
>> IDENTIFIER=?");
>> $sth->execute ('VALUE');
>> ($field_value) = $sth->fetchrow_array;
>
>Make sure to do an
>
>$sth->finish;
>
>before quitting. This will eliminate the warning.
Indeed. The reason is that, even if *you* know there is only one record,
but the DB doesn't know that, because it hasn't searched upto the end of
the recordset, yet.
If you were to repeat the $sth->fetchrow_array until it returned
nothing, *then* the DB would know there is no more. Then the warning
would disappear.
But "finish" is a smarter way of just disregarding any pending results
(even if there are none).
--
Bart.