Re: [PHP-PEAR] a bug in DB_common

[email protected] ((Stig Sæther Bakken)) 12 Mar 2001 10:37:46 +0100
Newsgroups php.pear
Message-ID <[email protected]>
[Alexey Borzov <[email protected]>]
> Greetings, php-pear!
> 
> 
> in function getAssoc() there is a loop which is supposed to return
> array of the form (first_col => second_col):
> 
>             // return scalar values
>             while (($row = $this->fetchRow($res)) && !DB::isError($row)) {
>                 $results[$row[0]] = $row[1];
>             }
> 
> it insists on accessing the $row's values by numeric indices and fails
> miserably when the default fetchmode is DB_FETCHMODE_ASSOC. I suppose
> the loop should read:
> 
>             // return scalar values
>             while (($row = $this->fetchRow($res, DB_FETCHMODE_ORDERED)) && !DB::isError($row)) {
>                 $results[$row[0]] = $row[1];
>             }

Hi, thanks for the notice, it's fixed in CVS.

 - Stig

-- 
  Stig Sæther Bakken <[email protected]>
  Fast Search & Transfer ASA, Trondheim, Norway